Fix order of reading environment variables

This commit is contained in:
Tulir Asokan 2022-02-16 19:37:11 +02:00
parent baddce264f
commit 172d18470f

View File

@ -122,9 +122,9 @@ func UserDataDir() (dir string, err error) {
if runtime.GOOS == "windows" || runtime.GOOS == "darwin" {
return UserConfigDir()
}
dir = os.Getenv("XDG_DATA_HOME")
if dir == "" {
dir = getRootDir("data")
if dir == "" {
dir = os.Getenv("XDG_DATA_HOME")
}
if dir == "" {
dir = os.Getenv("HOME")