Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bad config location on MacOS #297

Open
cyber opened this issue Jan 1, 2021 · 7 comments
Open

Bad config location on MacOS #297

cyber opened this issue Jan 1, 2021 · 7 comments

Comments

@cyber
Copy link

cyber commented Jan 1, 2021

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?

@cyber
Copy link
Author

cyber commented Jan 1, 2021

$HOME/.tinyrc.yml still works though?

@osa1
Copy link
Owner

osa1 commented Jan 1, 2021

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.

@cyber cyber closed this as completed Jan 1, 2021
@osa1
Copy link
Owner

osa1 commented Jan 1, 2021

Let's keep this open until we at least update the README.

@SeniorMars
Copy link

SeniorMars commented Jul 14, 2022

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.

@trevarj
Copy link
Contributor

trevarj commented Jul 15, 2022

@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:

let xdg_config_path = dirs::config_dir().map(|mut xdg_config_home| {

@osa1
Copy link
Owner

osa1 commented Jul 15, 2022

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 dirs-dev/directories-rs#47, dirs-dev/dirs-rs#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.

@osa1
Copy link
Owner

osa1 commented Dec 12, 2022

847dfff updates README to mention default config path on macOS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants