-
Notifications
You must be signed in to change notification settings - Fork 129
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
Respect XDG_* variables on macos if set #311
Comments
Hmm, XDG is a Freedesktop-Specification, and thus explicitly Linux-specific. Does it make sense to apply XDG-variables to macOS as well? Isn't there some kind of standard for macOS, regarding configurability of directory paths? |
It is, but most software coming from the Linux space does either use |
We're currently using the app_dirs2 crate for determining the app directory. This library currently does not take into account XDG env vars on macOS. Maybe you could ask there for an option to read XDG env vars on macOS as well? If that were present, we could enable it in Tealdeer (either by default, or through some kind of config option). |
Anyways, since XDG variables aren't supported at the moment: You can set The whole process is explained here: https://dbrgn.github.io/tealdeer/config.html Does this solve your root problem? |
I had also done a write-up about this here: dirs-dev/directories-rs#47 (comment). |
This is a similar situation as with #320: I agree that we should move to doing the saner thing (leaving |
First of all, So if you want XDG for config & Mac paths for cache, then you can do that. You just need to use the appropriate object. As a macOS user, I personally don't see the point of using Regarding transition, I can add a migration prompt or auto migration, as the maintainers prefer. |
For caches, using |
Yeah because |
I also think its important to respect XDG_* variables on macOS - the user has explicitly set them. Alternatively, allow use of env vars in the directory config paths. |
@utkarshgupta137 You already have a solid PR open for this, do you have an idea on how |
You would first check the XDG folders, if tealdeer files are found, you use that. Else you check for old (current) locations, if tealdeer files are found, use them, but give the user a warning. If neither found, create new files in the XDG folders. |
Sounds good, except for the "creating new files" part - this should only happen when using |
Hmm, there are now two discussion topics in this thread. Question 1: If I'm not a macOS user myself and don't know the typical conventions, but even though XDG is a Linux standard, it probably still makes sense to use Question 2: Should the XDG-style cache directory be the default on macOS? Here I'm not sure, and comments like this one by @d12bb indicate that there's good reason for at least some of these defaults. I have the feeling that we should allow using XDG conventions if the variables are explicitly set by the user, but use the current defaults otherwise. In case of the cache directory, this has the advantage that it's not being backed up by default. If we keep the cache in Thus, my suggestion would be to accept Migration path If we don't change the defaults, but accept the I think it would be sufficient to print a big migration warning when:
This migration warning could be removed after a few releases. Note that in most cases, this change should not interfere with auto-cache-updates because auto-updates are off by default and the config won't be found if the lookup paths change. (In theory, someone could set the XDG cache directory variable but not the config directory variable, but I think we can accept that edge case.) What do you think, @niklasmohrin? |
I think you summarized the issues very well!
Indeed, this was my thought as well. If the user sets XDG variables we should definitely respect their choices but if they don't we should put files where the OS expects them.
Lovely!
That sounds like a good plan to me. |
I think @dbrgn's comment sums up the current state of the issue. Sounds good to me, looking forward to PRs! |
I just want to chime in and say: |
When the user explicitly has set the
XDG_*
variables, tealdeer should use them on macOS like it does on Linux, falling back to Mac conventions if not set.The text was updated successfully, but these errors were encountered: