Skip to content

Commit 2576567

Browse files
committed
change for non-default Windows installation drive
1 parent 6d948fd commit 2576567

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

pkg/drivers/vmware/vmware_windows.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,20 @@ package vmware
1818

1919
import (
2020
"fmt"
21-
"golang.org/x/sys/windows/registry"
21+
"os"
2222
"path/filepath"
23+
24+
"golang.org/x/sys/windows/registry"
2325
)
2426

27+
// https://docs.microsoft.com/en-us/windows/deployment/usmt/usmt-recognized-environment-variables
2528

2629
func DhcpConfigFiles() string {
27-
return `C:\ProgramData\VMware\vmnetdhcp.conf`
30+
return filepath.Join(os.Getenv("ALLUSERSPROFILE"), `VMware\vmnetdhcp.conf`)
2831
}
2932

3033
func DhcpLeaseFiles() string {
31-
return `C:\ProgramData\VMware\vmnetdhcp.leases`
34+
return filepath.Join(os.Getenv("ALLUSERSPROFILE"), `VMware\vmnetdhcp.leases`)
3235
}
3336

3437
func SetUmask() {
@@ -67,5 +70,5 @@ func setVmwareCmd(cmd string) string {
6770
}
6871

6972
func getShareDriveAndName() (string, string, string) {
70-
return "Users", "C:\\Users", "/hosthome"
73+
return "Users", os.Getenv("PUBLIC"), "/hosthome"
7174
}

0 commit comments

Comments
 (0)