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

XDG directory functions do not respect XDG variables on macOS #2434

Open
uncenter opened this issue Oct 19, 2024 · 4 comments · May be fixed by #2439
Open

XDG directory functions do not respect XDG variables on macOS #2434

uncenter opened this issue Oct 19, 2024 · 4 comments · May be fixed by #2439

Comments

@uncenter
Copy link

Due to long standing difficulties with (a/the) maintainer of dirs-rs, they refuse to recognize XDG environment variables explicitly defined by the user on macOS: dirs-dev/directories-rs#47. config_directory() will always go to /Users/<username>/Library/Application Support on macOS, even if you have set XDG_CONFIG_HOME. I would suggest using https://github.com/lunacookies/etcetera instead, though there may be other alternatives that also respect user preferences.

@laniakea64
Copy link
Contributor

Changing the behavior of the existing functions would break just's backwards-compatibility guarantee. This would need to be a new function (maybe named xdg_config_directory()?)

@uncenter
Copy link
Author

Yeah that's sound good, we should still update the documentation for the normal config_directory() functions to clarify that they return the path for the operating system specification - right now they are literally called "XDG Directories", that name (and description) would be fitting for xdg_config_directory() instead :)

@uncenter
Copy link
Author

Well, dirs is used for other features like global justfile locating:

just/src/search.rs

Lines 14 to 19 in 4f31853

fn global_justfile_paths() -> Vec<PathBuf> {
let mut paths = Vec::new();
if let Some(config_dir) = dirs::config_dir() {
paths.push(config_dir.join("just").join(DEFAULT_JUSTFILE_NAME));
}

But since that wouldn't affect the backwards compatability of the justfiles themselves would that be a change that could be made at some point as well?

@uncenter uncenter linked a pull request Oct 23, 2024 that will close this issue
@casey
Copy link
Owner

casey commented Oct 30, 2024

Regarding #2439, I see the benefit, but it seems unfortunate to add a bunch more functions that are very close to existing functions.

An alternative option would be to add a setting, like set use-xdg-directories, which would change the behavior of directory functions to respect the XDG variables.

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

Successfully merging a pull request may close this issue.

3 participants