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

Honor XDG variables on MacOS #56

Closed
AntoinePrv opened this issue Apr 27, 2024 · 6 comments
Closed

Honor XDG variables on MacOS #56

AntoinePrv opened this issue Apr 27, 2024 · 6 comments

Comments

@AntoinePrv
Copy link

Some MacOS users would like to use XDG configuration, especially for everything terminal related. Many tools out-there actually support it.

It would be great if dirs could honor these environment variables on MacOS too. I'm only talking of honoring the environment variables, not the default locations, so that this remains strictly opt-in.

Another way to make this even safer is to check an additional XDG_FORCE_MACOS environment variable. That way updating dirs will not break workflow of users that are already using XDG and ~/Library.

@soc
Copy link
Collaborator

soc commented Apr 28, 2024

Hi @AntoinePrv, please see dirs-dev/directories-rs#47 (comment).

@soc soc closed this as completed Apr 28, 2024
@CGamesPlay
Copy link

This doesn't feel like a duplicate to me. In the linked issue, you mentioned that macOS has a standard location for these directories, and dirs uses those standard directories. That sounds completely reasonable.

However, this issue is about providing a user-facing customization hook hook for this (XDG environment variables), in particular one that plays nicely with customization hooks available on other platforms (which many of the consumers of this crate are compiling for as well). In particular, the linked comment gives an example: "add exclusions to macOS' backup software (Library/Caches is excluded, .cache isn't)". If the user is setting a custom XDG_CACHE_DIR, it's safe to assume they have added the exclusion mentioned.

Can you clarify your stance on why support for the environment variables should not be added to dirs?

@soc
Copy link
Collaborator

soc commented Jun 28, 2024

@CGamesPlay This library intends to implement the platform conventions as defined by the respective OS vendors, not what people want it to be.
The Apple documentation does not mention XDG_FORCE_MACOS.

@CGamesPlay
Copy link

Thanks for taking the time to respond!

@mortenscheel
Copy link

I know I probably won't change your mind, but I'll say it anyway: Those folder conventions you link to, are for GUI apps.
For CLI tools, even those that Apple provide out of the box, it's much more common that they follow UNIX conventions.

E.g. MacOS ships with zsh as the default shell. Its default configuration is in /etc/zshrc, and the default location for user-defined config is $HOME/.zshrc. If we follow your conventions, the config should be placed in /Users/{username}/Library/Application Support/zsh/.zshrc. But zsh won't look for a config file there (unless you create it manually and point ZDOTDIR at it). And it makes perfect sense for file paths that you'll usually edit from the terminal. Who in their right mind would use a path that includes whitespace for that?

Look, I'm not claiming that there is an official guideline similar to XDG for mac. But the vast majority of cli tools you can install via homebrew, use either $HOME/.{app-name} or $HOME/.config/{app-name}. The few that don't are all Rust tools that use your package to determine the location.

@soc
Copy link
Collaborator

soc commented Jul 19, 2024

The CLI tools are wrong and should fix their implementation.

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