fix: use ~/.config/s2/config.toml for config path#188
Conversation
Greptile SummaryChanged the config file path resolution for non-Windows systems from Key Changes:
Concerns:
Confidence Score: 3/5
Important Files Changed
Sequence DiagramsequenceDiagram
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
|
| let mut path = dirs::home_dir().ok_or(CliConfigError::DirNotFound)?; | ||
| path.push(".config"); |
There was a problem hiding this 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:
- Adding migration logic to copy old configs
- Documenting this breaking change in the changelog
- 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.
No description provided.