mirror of
https://github.com/psviderski/uncloud.git
synced 2026-08-26 11:03:34 +00:00
fix: use os.UserHomeDir() instead of $HOME
This commit is contained in:
+5
-3
@@ -13,9 +13,11 @@ func ExpandHomeDir(path string) string {
|
|||||||
return path
|
return path
|
||||||
}
|
}
|
||||||
if path[0] == '~' {
|
if path[0] == '~' {
|
||||||
// TODO: Improve compat with other OSes
|
home, err := os.UserHomeDir()
|
||||||
path = strings.Replace(path, "~", "${HOME}", 1)
|
if err != nil {
|
||||||
return os.ExpandEnv(path)
|
return path
|
||||||
|
}
|
||||||
|
return strings.Replace(path, "~", home, 1)
|
||||||
}
|
}
|
||||||
return path
|
return path
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user