fix: respect $XDG_CONFIG_HOME

This commit is contained in:
Romain Bertrand 2026-03-12 15:44:24 +01:00
parent 527f6bf15f
commit 2ea1bff59d
2 changed files with 17 additions and 0 deletions

View file

@ -75,6 +75,20 @@ func TestGetConfigDir(t *testing.T) {
}
}
func TestGetConfigDir_XDG(t *testing.T) {
t.Setenv("XDG_CONFIG_HOME", "/custom/config")
dir, err := GetConfigDir()
if err != nil {
t.Fatalf("Unexpected error: %v", err)
}
expected := "/custom/config/fgj"
if dir != expected {
t.Errorf("Expected %q, got %q", expected, dir)
}
}
func TestGetConfigPath(t *testing.T) {
path, err := GetConfigPath()
if err != nil {