Module: VagrantPlugins::MultiHostManager::HostsFile::WindowsSupport

Defined in:
lib/vagrant-multihostmanager/hosts_file.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)


121
122
123
# File 'lib/vagrant-multihostmanager/hosts_file.rb', line 121

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

Instance Method Details

#windows_copy_file(source, dest) ⇒ Object



127
128
129
130
131
132
133
134
135
# File 'lib/vagrant-multihostmanager/hosts_file.rb', line 127

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