Module: VagrantPlugins::HostsProvisioner::Hosts::WindowsSupport

Defined in:
lib/vagrant-servant-hosts-provisioner/hosts.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)


210
211
212
# File 'lib/vagrant-servant-hosts-provisioner/hosts.rb', line 210

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

Instance Method Details

#windows_copy_file(source, dest) ⇒ Object



216
217
218
219
220
221
222
223
224
# File 'lib/vagrant-servant-hosts-provisioner/hosts.rb', line 216

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