mirror of
https://github.com/schollz/croc.git
synced 2024-11-23 23:54:17 +03:00
Check $HOME as last
This commit is contained in:
parent
d2b7c80369
commit
956598c427
@ -32,16 +32,15 @@ const NbBytesWords = 4
|
||||
|
||||
// Get or create home directory
|
||||
func GetConfigDir() (homedir string, err error) {
|
||||
homedir, err = os.UserHomeDir()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if envHomedir, isSet := os.LookupEnv("CROC_CONFIG_DIR"); isSet {
|
||||
homedir = envHomedir
|
||||
} else if xdgConfigHome, isSet := os.LookupEnv("XDG_CONFIG_HOME"); isSet {
|
||||
homedir = path.Join(xdgConfigHome, "croc")
|
||||
} else {
|
||||
homedir, err = os.UserHomeDir()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
homedir = path.Join(homedir, ".config", "croc")
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user