Remove legacy config path handling

This commit is contained in:
Jan Bader
2026-07-20 20:45:09 +02:00
parent 12aa0d4e21
commit 608dc99c45
3 changed files with 5 additions and 51 deletions
+1 -27
View File
@@ -10,7 +10,7 @@ func TestConfigFilePathUsesXDGConfigDir(t *testing.T) {
t.Setenv("HOME", t.TempDir())
t.Setenv("XDG_CONFIG_HOME", t.TempDir())
got, legacy, err := configFilePath()
got, err := configFilePath()
if err != nil {
t.Fatal(err)
}
@@ -18,30 +18,4 @@ func TestConfigFilePathUsesXDGConfigDir(t *testing.T) {
if got != want {
t.Fatalf("expected %q, got %q", want, got)
}
if legacy != "" {
t.Fatalf("expected no legacy fallback, got %q", legacy)
}
}
func TestConfigFilePathFallsBackToLegacyHomeFile(t *testing.T) {
home := t.TempDir()
xdg := filepath.Join(t.TempDir(), "config")
t.Setenv("HOME", home)
t.Setenv("XDG_CONFIG_HOME", xdg)
legacyPath := filepath.Join(home, "docspell-cli.json")
if err := os.WriteFile(legacyPath, []byte("{}"), 0644); err != nil {
t.Fatal(err)
}
got, legacy, err := configFilePath()
if err != nil {
t.Fatal(err)
}
if got != legacyPath {
t.Fatalf("expected legacy path %q, got %q", legacyPath, got)
}
wantLegacy := filepath.Join(xdg, "docspell-cli", "config.json")
if legacy != wantLegacy {
t.Fatalf("expected XDG target %q, got %q", wantLegacy, legacy)
}
}