Skip to content

Commit a426b85

Browse files
committed
Merge pull request #49 from Tpbrown/git-bash-windows
Support Cygwin and MinGW on Windows. Fixes #24
2 parents 9bc81fc + 8f3dd06 commit a426b85

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/vagrant-hostmanager/hosts_file.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ def update_guest(machine)
1010
realhostfile = '/etc/inet/hosts'
1111
move_cmd = 'mv'
1212
elsif (machine.communicate.test("test -d $Env:SystemRoot"))
13-
realhostfile = 'C:\Windows\System32\Drivers\etc\hosts'
13+
realhostfile = "#{ENV['WINDIR']}\\System32\\drivers\\etc\\hosts"
14+
1415
move_cmd = 'mv -force'
1516
else
1617
realhostfile = '/etc/hosts'
@@ -38,7 +39,7 @@ def update_host
3839
hosts_location = '/etc/hosts'
3940
copy_cmd = 'sudo cp'
4041
# handles the windows hosts file...
41-
if ENV['OS'] == 'Windows_NT'
42+
if ENV['SystemRoot'] != nil
4243
hosts_location = "#{ENV['WINDIR']}\\System32\\drivers\\etc\\hosts"
4344
copy_cmd = 'cp'
4445
end

0 commit comments

Comments
 (0)