Skip to content

Commit 0f3ba1a

Browse files
committed
Use the WSL convention for the windows machines default volumes
Signed-off-by: Mario Loriedo <mario.loriedo@gmail.com>
1 parent da79b1d commit 0f3ba1a

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

pkg/config/default_windows.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,14 @@ func getLibpodTmpDir() string {
4242
}
4343

4444
// getDefaultMachineVolumes returns default mounted volumes (possibly with env vars, which will be expanded)
45+
// It is executed only if the machine provider is Hyper-V and it mimics WSL
46+
// behavior where the host %SystemDrive% (e.g. C:\) is automatically mounted
47+
// in the guest under /mnt/ (e.g. /mnt/c/)
4548
func getDefaultMachineVolumes() []string {
4649
hd := homedir.Get()
4750
vol := filepath.VolumeName(hd)
48-
hostMnt := filepath.ToSlash(strings.TrimPrefix(hd, vol))
49-
return []string{fmt.Sprintf("%s:%s", hd, hostMnt)}
51+
hostMnt := "/mnt/" + strings.ToLower(vol[0:1])
52+
return []string{fmt.Sprintf("%s:%s", vol+"\\", filepath.ToSlash(hostMnt))}
5053
}
5154

5255
func getDefaultComposeProviders() []string {

0 commit comments

Comments
 (0)