1
1
Fork 0
mirror of https://github.com/schollz/croc.git synced 2025-10-11 05:11:06 +02:00

Merge pull request #340 from jfaltis/xdg-basedir-spec-compliance

Add compliance with XDG Base Directory Specification (XDG_CONFIG_HOME)
This commit is contained in:
Zack 2021-03-17 10:17:52 -07:00 committed by GitHub
commit 6caf72df82
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -131,6 +131,9 @@ func getConfigDir() (homedir string, err error) {
return
}
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) {
log.Debugf("creating home directory %s", homedir)
err = os.MkdirAll(homedir, 0700)