Module: VagrantPlugins::HostManager::HostsFile::Updater::WindowsSupport

Defined in:
lib/vagrant-hostmanager/hosts_file/updater.rb

Overview

Windows support for copying files, requesting elevated privileges if necessary

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.windows?Boolean

Returns:

  • (Boolean)


170
171
172
# File 'lib/vagrant-hostmanager/hosts_file/updater.rb', line 170

def self.windows?
  RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/
end

Instance Method Details

#windows_copy_file(source, dest) ⇒ Object



176
177
178
179
180
181
182
183
184
# File 'lib/vagrant-hostmanager/hosts_file/updater.rb', line 176

def windows_copy_file(source, dest)
  begin
    # First, try Ruby copy
    FileUtils.cp(source, dest)
  rescue Errno::EACCES
    # Access denied, try with elevated privileges
    windows_copy_file_elevated(source, dest)
  end
end