mirror of https://github.com/schollz/croc.git
add compliance with xdg base directory specification in regards to XDG_CONFIG_HOME
This commit is contained in:
parent
50aa24d86d
commit
2273438373
|
@ -131,6 +131,9 @@ func getConfigDir() (homedir string, err error) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
homedir = path.Join(homedir, ".config", "croc")
|
homedir = path.Join(homedir, ".config", "croc")
|
||||||
|
if xdgConfigHome, isSet := os.LookupEnv("XDG_CONFIG_HOME"); isSet {
|
||||||
|
homedir = path.Join(xdgConfigHome, "croc")
|
||||||
|
}
|
||||||
if _, err = os.Stat(homedir); os.IsNotExist(err) {
|
if _, err = os.Stat(homedir); os.IsNotExist(err) {
|
||||||
log.Debugf("creating home directory %s", homedir)
|
log.Debugf("creating home directory %s", homedir)
|
||||||
err = os.MkdirAll(homedir, 0700)
|
err = os.MkdirAll(homedir, 0700)
|
||||||
|
|
Loading…
Reference in New Issue