aboutsummaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/path.go11
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 {