mirror of
https://github.com/schollz/croc.git
synced 2025-10-11 13:21:00 +02:00
Check $HOME as last
This commit is contained in:
parent
d2b7c80369
commit
956598c427
1 changed files with 4 additions and 5 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue