1
0
mirror of https://github.com/schollz/croc.git synced 2024-11-24 08:02:33 +03:00

Check $HOME as last

This commit is contained in:
a1lu 2024-03-30 23:21:42 +01:00
parent d2b7c80369
commit 956598c427

View File

@ -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")
}