Skip to content

Commit 2d5d063

Browse files
fix: avoid erroring when $HOME is not defined (#3389)
Signed-off-by: Austin Abro <[email protected]>
1 parent 76f327c commit 2d5d063

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/config/config.go

+4-5
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,11 @@ func GetAbsCachePath() (string, error) {
103103

104104
// GetAbsHomePath replaces ~ with the absolute path to a user's home dir
105105
func GetAbsHomePath(path string) (string, error) {
106-
homePath, err := os.UserHomeDir()
107-
if err != nil {
108-
return "", err
109-
}
110-
111106
if strings.HasPrefix(path, "~") {
107+
homePath, err := os.UserHomeDir()
108+
if err != nil {
109+
return "", err
110+
}
112111
return strings.Replace(path, "~", homePath, 1), nil
113112
}
114113
return path, nil

0 commit comments

Comments
 (0)