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)


164
165
166
# File 'lib/vagrant-hostmanager/hosts_file/updater.rb', line 164

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

Instance Method Details

#windows_copy_file(source, dest) ⇒ Object



170
171
172
173
174
175
176
177
178
# File 'lib/vagrant-hostmanager/hosts_file/updater.rb', line 170

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