Summary
On macOS, treemd only reads config from ~/Library/Application Support/treemd/config.toml. It would be more convenient to prioritize ~/.config/treemd/config.toml instead.
Current Behavior
The Config::config_path() function uses dirs::config_dir(), which returns:
- Linux:
~/.config
- macOS:
~/Library/Application Support
- Windows:
%APPDATA%
This means ~/.config/treemd/config.toml is not recognized on macOS.
Proposed Behavior
On macOS, check both paths with the following priority:
~/.config/treemd/config.toml (primary)
~/Library/Application Support/treemd/config.toml (fallback)
Motivation
- Many CLI tools and developer-focused applications support
~/.config on macOS
- Easier dotfiles management with a unified
~/.config directory
- Simpler to sync configs across Linux and macOS environments
- Users who prefer the Apple-standard path can still use it as a fallback
Possible Implementation
In src/config.rs, modify the Config::load() method:
pub fn load() -> Self {
#[cfg(target_os = "macos")]
{
// Prefer XDG-style path on macOS
if let Some(home) = dirs::home_dir() {
let xdg_path = home.join(".config/treemd/config.toml");
if let Some(config) = Self::load_from_path(&xdg_path) {
return config;
}
}
}
// Fall back to platform-specific path
if let Some(config) = Self::config_path().and_then(|p| Self::load_from_path(&p)) {
return config;
}
Self::default()
}
This approach:
- Prioritizes ~/.config for users who prefer XDG-style paths
- Falls back to ~/Library/Application Support for existing users
- No change for Linux/Windows users
Summary
On macOS, treemd only reads config from
~/Library/Application Support/treemd/config.toml. It would be more convenient to prioritize~/.config/treemd/config.tomlinstead.Current Behavior
The
Config::config_path()function usesdirs::config_dir(), which returns:~/.config~/Library/Application Support%APPDATA%This means
~/.config/treemd/config.tomlis not recognized on macOS.Proposed Behavior
On macOS, check both paths with the following priority:
~/.config/treemd/config.toml(primary)~/Library/Application Support/treemd/config.toml(fallback)Motivation
~/.configon macOS~/.configdirectoryPossible Implementation
In
src/config.rs, modify theConfig::load()method:This approach: