We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 9bc81fc + 8f3dd06 commit a426b85Copy full SHA for a426b85
lib/vagrant-hostmanager/hosts_file.rb
@@ -10,7 +10,8 @@ def update_guest(machine)
10
realhostfile = '/etc/inet/hosts'
11
move_cmd = 'mv'
12
elsif (machine.communicate.test("test -d $Env:SystemRoot"))
13
- realhostfile = 'C:\Windows\System32\Drivers\etc\hosts'
+ realhostfile = "#{ENV['WINDIR']}\\System32\\drivers\\etc\\hosts"
14
+
15
move_cmd = 'mv -force'
16
else
17
realhostfile = '/etc/hosts'
@@ -38,7 +39,7 @@ def update_host
38
39
hosts_location = '/etc/hosts'
40
copy_cmd = 'sudo cp'
41
# handles the windows hosts file...
- if ENV['OS'] == 'Windows_NT'
42
+ if ENV['SystemRoot'] != nil
43
hosts_location = "#{ENV['WINDIR']}\\System32\\drivers\\etc\\hosts"
44
copy_cmd = 'cp'
45
end
0 commit comments