fix: use os.UserHomeDir() instead of $HOME

This commit is contained in:
Connor Edwards
2025-02-08 15:56:18 +00:00
parent ac48b8bee6
commit 408703360c
+5 -3
View File
@@ -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
} }