diff options
Diffstat (limited to 'internal/appconfig')
| -rw-r--r-- | internal/appconfig/config.go | 6 | ||||
| -rw-r--r-- | internal/appconfig/config_test.go | 8 |
2 files changed, 7 insertions, 7 deletions
diff --git a/internal/appconfig/config.go b/internal/appconfig/config.go index 859b2c1..8ae9597 100644 --- a/internal/appconfig/config.go +++ b/internal/appconfig/config.go @@ -1284,7 +1284,7 @@ func ConfigPath() (string, error) { return configPath, nil } -// StateDir returns the XDG state directory for hexai (~/.local/state/hexai by default). +// StateDir returns the XDG state directory for hexai (~/.local/hexai/state by default). // Creates the directory if it doesn't exist. This is used for persistent state data // like logs and history that should survive reboots. func StateDir() (string, error) { @@ -1294,10 +1294,10 @@ func StateDir() (string, error) { if err != nil { return "", fmt.Errorf("cannot find user home directory: %v", err) } - stateHome = filepath.Join(home, ".local", "state") + stateHome = filepath.Join(home, ".local", "hexai") } - stateDir := filepath.Join(stateHome, "hexai") + stateDir := filepath.Join(stateHome, "state") if err := os.MkdirAll(stateDir, 0o755); err != nil { return "", fmt.Errorf("cannot create state directory: %v", err) } diff --git a/internal/appconfig/config_test.go b/internal/appconfig/config_test.go index ed7254c..cf9a725 100644 --- a/internal/appconfig/config_test.go +++ b/internal/appconfig/config_test.go @@ -321,7 +321,7 @@ func TestStateDir_XDG(t *testing.T) { if err != nil { t.Fatalf("StateDir: %v", err) } - expected := filepath.Join(dir, "hexai") + expected := filepath.Join(dir, "state") if stateDir != expected { t.Fatalf("expected %q, got %q", expected, stateDir) } @@ -337,9 +337,9 @@ func TestStateDir_Default(t *testing.T) { if err != nil { t.Fatalf("StateDir: %v", err) } - // Should default to ~/.local/state/hexai - if !strings.Contains(stateDir, ".local/state/hexai") { - t.Fatalf("expected path to contain .local/state/hexai, got %q", stateDir) + // Should default to ~/.local/hexai/state + if !strings.Contains(stateDir, ".local/hexai/state") { + t.Fatalf("expected path to contain .local/hexai/state, got %q", stateDir) } // Verify directory was created if _, err := os.Stat(stateDir); err != nil { |
