aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2016-01-08 21:24:49 +0800
committerFelix Lange <fjl@twurst.com>2016-01-08 21:24:49 +0800
commit0ab8a175d812462a5233065f3c729cd67d6ccc90 (patch)
tree2e8d1e671fc141c2f6907f7567d5bdf57119b61e
parent32226f1b0cb98286cfd3f2898c344df1dfca45ec (diff)
parente2fdd335415d39083ef9ff5950dd4050f25b193a (diff)
downloaddexon-0ab8a175d812462a5233065f3c729cd67d6ccc90.tar
dexon-0ab8a175d812462a5233065f3c729cd67d6ccc90.tar.gz
dexon-0ab8a175d812462a5233065f3c729cd67d6ccc90.tar.bz2
dexon-0ab8a175d812462a5233065f3c729cd67d6ccc90.tar.lz
dexon-0ab8a175d812462a5233065f3c729cd67d6ccc90.tar.xz
dexon-0ab8a175d812462a5233065f3c729cd67d6ccc90.tar.zst
dexon-0ab8a175d812462a5233065f3c729cd67d6ccc90.zip
Merge pull request #2110 from LefterisJP/determining_home_for_ubuntu_core
common: Fix HomeDir detection
-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 {