Skip to content
This repository was archived by the owner on Jan 30, 2026. It is now read-only.

fix: use ~/.config/s2/config.toml for config path#188

Merged
infiniteregrets merged 1 commit intomainfrom
m/fix-config-dir
Jan 16, 2026
Merged

fix: use ~/.config/s2/config.toml for config path#188
infiniteregrets merged 1 commit intomainfrom
m/fix-config-dir

Conversation

@infiniteregrets
Copy link
Member

No description provided.

@infiniteregrets infiniteregrets requested a review from a team as a code owner January 16, 2026 18:52
@greptile-apps
Copy link

greptile-apps bot commented Jan 16, 2026

Greptile Summary

Changed the config file path resolution for non-Windows systems from dirs::config_dir() to dirs::home_dir() + .config. This standardizes the config location to ~/.config/s2/config.toml for all Unix-like systems.

Key Changes:

  • Linux: No change - still uses ~/.config/s2/config.toml
  • macOS: Breaking change - moves from ~/Library/Application Support/s2/config.toml to ~/.config/s2/config.toml
  • Windows: No change - still uses %APPDATA%\s2\config.toml

Concerns:

  • This breaks existing macOS installations without migration logic or documentation
  • macOS convention is to use ~/Library/Application Support for app configs, not ~/.config
  • No migration path for existing users to move their configs

Confidence Score: 3/5

  • This PR introduces a breaking change for macOS users without migration support
  • The code change itself is simple and safe from a compilation perspective, but it breaks macOS convention and existing user configs without providing migration logic or clear documentation. The change may be intentional to standardize paths, but lacks the necessary support for a smooth transition.
  • src/config.rs requires attention for macOS compatibility and migration strategy

Important Files Changed

Filename Overview
src/config.rs Changed config path from platform-specific to Unix-style .config for all non-Windows systems, which breaks macOS convention

Sequence Diagram

sequenceDiagram
    participant User
    participant CLI
    participant config_path()
    participant FileSystem

    User->>CLI: Execute s2 command
    CLI->>config_path(): Get config file path
    
    alt Windows
        config_path()->>dirs: config_dir()
        dirs-->>config_path(): %APPDATA%/s2
        config_path()->>config_path(): Append "config.toml"
        config_path()-->>CLI: %APPDATA%/s2/config.toml
    else Non-Windows (Linux/macOS)
        config_path()->>dirs: home_dir()
        dirs-->>config_path(): $HOME
        config_path()->>config_path(): Append ".config"
        config_path()->>config_path(): Append "s2"
        config_path()->>config_path(): Append "config.toml"
        config_path()-->>CLI: ~/.config/s2/config.toml
    end
    
    CLI->>FileSystem: Check if config exists
    alt Config exists
        FileSystem-->>CLI: Read config file
        CLI->>CLI: Parse TOML config
    else Config doesn't exist
        CLI->>CLI: Use default config
    end
    
    CLI->>CLI: Override with env vars (S2_*)
    CLI->>User: Execute command with config
Loading

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 file reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

Comment on lines +48 to +49
let mut path = dirs::home_dir().ok_or(CliConfigError::DirNotFound)?;
path.push(".config");
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: This change breaks macOS convention. Previously, dirs::config_dir() would return ~/Library/Application Support on macOS (following Apple's guidelines), but now it will use ~/.config for all non-Windows platforms. This is a breaking change for existing macOS users whose config files are in ~/Library/Application Support/s2/config.toml.

If this is intentional to standardize on XDG paths across all Unix-like systems, consider:

  1. Adding migration logic to copy old configs
  2. Documenting this breaking change in the changelog
  3. Or using platform-specific paths: #[cfg(target_os = "macos")] to preserve macOS convention

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/config.rs
Line: 48:49

Comment:
**logic:** This change breaks macOS convention. Previously, `dirs::config_dir()` would return `~/Library/Application Support` on macOS (following Apple's guidelines), but now it will use `~/.config` for all non-Windows platforms. This is a breaking change for existing macOS users whose config files are in `~/Library/Application Support/s2/config.toml`.

If this is intentional to standardize on XDG paths across all Unix-like systems, consider:
1. Adding migration logic to copy old configs
2. Documenting this breaking change in the changelog
3. Or using platform-specific paths: `#[cfg(target_os = "macos")]` to preserve macOS convention

<sub>Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!</sub>

How can I resolve this? If you propose a fix, please make it concise.

@infiniteregrets infiniteregrets merged commit d1d10da into main Jan 16, 2026
4 checks passed
@infiniteregrets infiniteregrets deleted the m/fix-config-dir branch January 16, 2026 18:55
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant