forked from cerc-io/plugeth
Merge pull request #2110 from LefterisJP/determining_home_for_ubuntu_core
common: Fix HomeDir detection
This commit is contained in:
commit
0ab8a175d8
@ -63,13 +63,14 @@ func AbsolutePath(Datadir string, filename string) string {
|
||||
return filepath.Join(Datadir, filename)
|
||||
}
|
||||
|
||||
func HomeDir() (home string) {
|
||||
if usr, err := user.Current(); err == nil {
|
||||
home = usr.HomeDir
|
||||
} else {
|
||||
home = os.Getenv("HOME")
|
||||
func HomeDir() string {
|
||||
if home := os.Getenv("HOME"); home != "" {
|
||||
return home
|
||||
}
|
||||
return
|
||||
if usr, err := user.Current(); err == nil {
|
||||
return usr.HomeDir
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func DefaultDataDir() string {
|
||||
|
Loading…
Reference in New Issue
Block a user