tiny
tiny copied to clipboard
Bad config location on MacOS
Installed tiny via:
cargo install --git https://github.com/osa1/tiny
$XDG_CONFIG_HOME is set to /Users/name/.config
$HOME is set to /Users/name
However when running for the first time:
tiny couldn't find a config file at "/Users/name/Library/Application Support/tiny/config.yml", and created a config file with defaults.
And tiny creates a config file in that location. Subsequent runs will continue to read from that location (env variables still set / config.yml copy-pasted to ~/.config/tiny/config.yml
Why is the config file in this obscure location?
$HOME/.tinyrc.yml still works though?
On MacOS we use the standard directories. This is done via the dirs crate.
I have no idea if this is ideal or not though, as I'm not a MacOS user. Is this not a standard location on MacOS?
$HOME/.tinyrc.yml still works though?
Yes, but it's deprecated. I'll probably remove it before v1.0.
At the very least we should update the README to mention the standard directories on MacOS. Currently it reads as if we always use XDG_CONFIG_HOME.
Let's keep this open until we at least update the README.
I'll update the readme, but I'm not sure this is considered a fix. I would think that most IRC users are familiar with the UNIX filesystem, and would prefer the option to use XDG_CONFIG_HOME. I can tackle the issue if I get a bit of direction.
@KarlWithK It seems that the issue is the dirs crate uses $HOME/Library/Application Support on MacOS, and we are calling this instead of inspecting the actual value of $XDG_CONFIG_HOME or $HOME.
Is that $XDG_CONFIG_HOME value set by you or the current version of MacOS?
See here: https://github.com/osa1/tiny/blob/60363548a089a12f8e5ac912338a4b297a79baf9/crates/tiny/src/config.rs#L152
I'm not a Mac user myself and I don't know the conventions on macOS, so in the past I trusted dirs to do the right thing on macOS.
I did a quick search. It seems like using ~/.config is common in macOS, but it's not the platform recommendation (1 and 2). Apparently people requested dirs to support ~/.config (or $XDG_CONFIG_PATH) in https://github.com/dirs-dev/directories-rs/issues/47, https://github.com/dirs-dev/dirs-rs/issues/35, and indirectly in downstream issues (see linked issues in directories-rs#47), but the author of dirs doesn't want to add it.
As long as we use the recommended path(s) by default (i.e. $HOME/Library/Application Support on macOS) I'm not opposed to providing a way to override it to a non-standard location.
I say we update the get_config_path function linked by Trevor above to check $XDG_CONFIG_HOME on macOS when a config is not found in the standard location.
847dfff updates README to mention default config path on macOS.