mirror of
https://github.com/google/gops.git
synced 2024-11-27 08:31:17 +02:00
Check $XDG_CONFIG_HOME before falling to ~/.config (#99)
This commit is contained in:
parent
59c8be2ead
commit
71c4255d55
@ -25,6 +25,11 @@ func ConfigDir() (string, error) {
|
||||
if runtime.GOOS == "windows" {
|
||||
return filepath.Join(os.Getenv("APPDATA"), "gops"), nil
|
||||
}
|
||||
|
||||
if xdgConfigDir := os.Getenv("XDG_CONFIG_HOME"); xdgConfigDir != "" {
|
||||
return filepath.Join(xdgConfigDir, "gops"), nil
|
||||
}
|
||||
|
||||
homeDir := guessUnixHomeDir()
|
||||
if homeDir == "" {
|
||||
return "", errors.New("unable to get current user home directory: os/user lookup failed; $HOME is empty")
|
||||
|
Loading…
Reference in New Issue
Block a user