mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-05-14 20:16:36 +00:00
Merge pull request #2110 from LefterisJP/determining_home_for_ubuntu_core
common: Fix HomeDir detection
This commit is contained in:
commit
0ab8a175d8
1 changed files with 7 additions and 6 deletions
|
|
@ -63,13 +63,14 @@ func AbsolutePath(Datadir string, filename string) string {
|
||||||
return filepath.Join(Datadir, filename)
|
return filepath.Join(Datadir, filename)
|
||||||
}
|
}
|
||||||
|
|
||||||
func HomeDir() (home string) {
|
func HomeDir() string {
|
||||||
if usr, err := user.Current(); err == nil {
|
if home := os.Getenv("HOME"); home != "" {
|
||||||
home = usr.HomeDir
|
return home
|
||||||
} else {
|
|
||||||
home = os.Getenv("HOME")
|
|
||||||
}
|
}
|
||||||
return
|
if usr, err := user.Current(); err == nil {
|
||||||
|
return usr.HomeDir
|
||||||
|
}
|
||||||
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
func DefaultDataDir() string {
|
func DefaultDataDir() string {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue