diff options
Diffstat (limited to 'common/path.go')
-rw-r--r-- | common/path.go | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/common/path.go b/common/path.go index 39eacacee..9ba2f93c0 100644 --- a/common/path.go +++ b/common/path.go @@ -63,13 +63,14 @@ func AbsolutePath(Datadir string, filename string) string { return filepath.Join(Datadir, filename) } -func HomeDir() (home string) { +func HomeDir() string { + if home := os.Getenv("HOME"); home != "" { + return home + } if usr, err := user.Current(); err == nil { - home = usr.HomeDir - } else { - home = os.Getenv("HOME") + return usr.HomeDir } - return + return "" } func DefaultDataDir() string { |