mirror of
https://github.com/wavetermdev/waveterm.git
synced 2024-12-21 16:38:23 +01:00
ExpandHomeDir Fix on Windows (#909)
fix: check for backslash when expanding the home directory (~ character -> full path)
This commit is contained in:
parent
f667ccce20
commit
7b56b0fb00
@ -52,7 +52,7 @@ func GetHomeDir() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func ExpandHomeDir(pathStr string) (string, error) {
|
func ExpandHomeDir(pathStr string) (string, error) {
|
||||||
if pathStr != "~" && !strings.HasPrefix(pathStr, "~/") {
|
if pathStr != "~" && !strings.HasPrefix(pathStr, "~/") && (!strings.HasPrefix(pathStr, `~\`) || runtime.GOOS != "windows") {
|
||||||
return filepath.Clean(pathStr), nil
|
return filepath.Clean(pathStr), nil
|
||||||
}
|
}
|
||||||
homeDir := GetHomeDir()
|
homeDir := GetHomeDir()
|
||||||
|
Loading…
Reference in New Issue
Block a user