fix(environment): detect WSL shared path correctly

This commit is contained in:
L. Yeung 2022-08-29 15:43:43 +08:00 committed by Jan De Dobbeleer
parent c93d637128
commit 7e141fb5ec

View file

@ -98,7 +98,11 @@ func (env *ShellEnvironment) WindowsRegistryKeyValue(path string) (*WindowsRegis
} }
func (env *ShellEnvironment) InWSLSharedDrive() bool { func (env *ShellEnvironment) InWSLSharedDrive() bool {
return env.IsWsl() && strings.HasPrefix(env.Pwd(), "/mnt/c") if !env.IsWsl() {
return false
}
windowsPath := env.ConvertToWindowsPath(env.Pwd())
return !strings.HasPrefix(windowsPath, `\\wsl.localhost`)
} }
func (env *ShellEnvironment) ConvertToWindowsPath(path string) string { func (env *ShellEnvironment) ConvertToWindowsPath(path string) string {