Global Config Discovery: use `$XDG_CONFIG_HOME` on macOS
Hi, I'm newly migrating to ruff and it works so far so good for me, thank you for making this great tool!
However, I noticed that ruff uses the config_dir in dirs crates, which goes to $HOME/Library/Application Support under macOS. Generally I believe that as a CLI tool (and like many others), ruff should probably stick with XDG config home under macOS. When I look into my $HOME/Library/Application Support, they're almost all GUI application stuffs. Also, I think it is expected & intuitional to read config from $XDG_CONFIG_HOME since macOS mostly behave in *nix way.
Please let me know what you think :)
This seems reasonable to me but I'd like to hear from someone else on our team first too.
We have a similar request in a comment for uv as well: https://github.com/astral-sh/uv/issues/1511
I'm not a macOS user so I don't have a good sense of what the right choice is. But my understanding is that XDG_CONFIG_HOME is commonly used on macOS. I have a fair number of things in my ~/.config directory on my test mac mini for example.
I prefer Linux to macOS but use macOS as a daily driver and I would be very confused if ~/.config was not a valid configuration path.
I use macOS exclusively. Honestly, I wouldn't know where to expect the config to go. I'd have to look it up in the docs for any given tool. But looking at my machine, I do think ~/.config is more appropriate.
That was a matter of discussion for PDM too (which does not recognise the XDG_* vars for macOS). PDM does this because the underlying Python package platformdirs does this. As a mac user who versions their dotfiles, I spent a bit of time to make sure that as many projects as I use can save data under ~/.config. It makes the most sense, it's more portable.
Could you report this upstream at https://github.com/dirs-dev/dirs-rs? I'm not a mac user so i'm not qualified to weigh in on this, i just wouldn't want to diverge from the effective rust standard without an upstream discussion first
@konstin I think it's been discussed before upstream and they are pretty opposed: https://github.com/dirs-dev/directories-rs/issues/47
I don't think I'd consider dirs-rs to be an effective Rust standard personally. But it is probably the most popular implementation of XDG.
There's also some other discussion that touches on this topic here: https://internals.rust-lang.org/t/pre-rfc-split-cargo-home/19747
And in particular, it looks like dirs won't respect XDG_CONFIG_HOME on macOS? https://github.com/dirs-dev/directories-rs/issues/47#issuecomment-596467168
If we want xdg over the platform default on mac, we should consider switching to something like etcetera's Xdg and etcetera::app_strategy::choose_app_strategy ("Returns the current OS’s default AppStrategy This uses the Windows strategy on Windows, and Xdg everywhere else.") over directories.