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
}
if path[0] == '~' {
// TODO: Improve compat with other OSes
path = strings.Replace(path, "~", "${HOME}", 1)
return os.ExpandEnv(path)
home, err := os.UserHomeDir()
if err != nil {
return path
}
return strings.Replace(path, "~", home, 1)
}
return path
}