-
Notifications
You must be signed in to change notification settings - Fork 36
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
Support for using ~/.config on Mac for command line apps #47
Comments
Do cli apps on Mac also use the XDG data folder ( |
Yeah that definitely works for Mac but then it doesn’t for Windows. (I don’t have a windows machine but as far as I can tell XDG is not the standard there) |
For instance, Neovim does not use XDG on windows |
I want to add my answer on Stack Overflow to the reasons of using If we don’t want to break compatibility, how about providing a struct |
Nothing on Windows uses XDG. |
I will not support this: Either we also change cache folders and therefore force everyone to add exclusions to macOS' backup software ( As a general advice for macOS devs: If you are developing on their platform, do what the platform owners tell you. They are the lords, you are the share-croppers. |
I closed this, but anyone should feel free to reopen if that person has new information. |
If I manually set the environment variable |
Cross-platform CLI apps that write to ~/Library on macOS feel wrong to me. I would really like my CLI apps to use |
It feels like respecting a set value for While I would probably opt to not set |
Agree. When users set |
I would be very surprised if a program behaved differently with |
No, it won't. |
Suggestion: Add an argument to the |
OK, so if they tell me that their I am a macOS 'platform owner', as well as Linux, and my I can.. understand wanting to use Library or whatever if nothing's specified, but if (By the way, I found etcetera, which supports different 'strategies' for choosing base directories, such as an |
The justification for refusing this feels very wrong to me. Apple is not all-knowing and users that are setting I can understand the default case not respecting |
Not all-knowing, but omnipotent on their hardware. They call the shots on their devices. That's the bargain you make when you buy something from them. |
@soc Apple does not tell you not to use environment variables to configure where data is stored on 'their' devices, that's absurd. |
@OJFord Apple defines where various kinds of data are stored. The rules do not contain an "in case you want to make up your on conventions ..." section. |
It defines defaults and standard practices. Sane CLI/TUI and other programmer tools in particular respect XDG if used. Hell, many use the $HOME or $HOME/.config without the option; respecting neither Apple nor XDG's standard. I have absolutely no idea why you would think it makes sense togo out of your way to ignore (based on the platform) an environment variable explicitly set by the user. Is Apple paying you to uphold such ideals? I don't currently have any macOS systems, so I don't care that much, I just think this is absurd, and I wouldn't use this crate for my own tools on that basis; not wishing it on any Mac users I may have. |
The directories crate doesn't use XDG on macOS, which is apparently the preferred way for CLI apps to store configuration. See: dirs-dev/directories-rs#47 dirs-dev/directories-rs#62
You can address that issue by setting an extended attribute after you create the directory: xattr -w com.apple.metadata:com_apple_backup_excludeItem \
com.apple.backupd "${XDG_CACHE_HOME}"
xattr -w com.apple.metadata:com_apple_backup_excludeItem \
com.apple.backupd "${XDG_RUNTIME_DIR}" |
@sdavids This library does – by design – neither create directories nor check whether they exist. Mutating extended attributes is not going to happen. |
I do understand the rationale of @soc as much as I hate the outcome. Every time I see I legit don't care if my computer crashes and burns and/or all my life's work's get's deleted as long as I can avoid using MacOS designated default dirs, I would take all the blame that came with it, but of course doing it as a Library that aims to do one thing would mean having to deal with all those user errors constantly, so I can't blame @soc for not wanting to cross that path, after all, is a MacOS flaw, and we should point our forks towards that porch. But of course nothing would change, just like it still has the worst Window Management on all the OS's available. But while I respect the decision, and judging by the amount of petitions, why not allow for an env var that bypassed the OS detection? Wouldn't it be good for debugging too? The only alternative would be switching to etcetera, right? |
I have personally switched to etcetera over this, and i think it works perfectly well, with a nice API. The main "problem" is, for whatever reason, new tools seem to tend to choose this lib by default, not realizing the side effect; then receive bug reports about the macos behavior afterward (like nushell). And then either manually work around it, like i've seen a few tools do, or else feel stuck because it would result in wide ranging breaking changes to switch (like nushell, who's issue has been open for 5 years). At the same time, this library is farly clear in the readme about what it provides, and it's not in its own best interests to specifically call out this behavior any more clearly... |
Can't you create a symlink if that's your issue? |
Nope, I share my dotfiles on mac and linux, in fact my |
Not sure I get that – if you symlink I'd imagine the bigger issue you have is that the application naming rules are different between Linux and macOS, i. e. your application Do your tool use some kind of mapping file that translates between naming on Linux and naming on macOS? |
I think the "in fact my It sounds like they don't go with my " (An approach I take because it keeps |
Yup
Not sure I got that part
You should look into stow then. I essentially .gitignore I don't do any mapping, just all my stuff uses XDG dire. And |
So your whole scheme not only requires that the applications you use are poorly ported to macOS, but also that the application authors never improve on that? 😦 |
you're putting a lot of assumption and assertion about how macos CLI applications should and should not act, with (imo) very little evidence to support that things should act that way, and no other way. Swiftlang's 1st party package manager supports XDG on macos. Also homebrew does, as an example of a piece of CLI software (originally) explicitly designed for macos. As do numerous other apps, both CLI and otherwise that have gotten feedback from enough people to decide to support it. also nushell/nushell#893 (comment)
and
|
Ok, that argument. |
Yeah. By that reasoning, it sounds like |
Perhaps, but I generally prefer not to add new dependencies when I'm doing OK with what I have.
I use Ansible playbooks inside my repo for that. Bear in mind that my repo isn't really something I use as a roaming profile... more a template for bringing up user profiles on new machines with some dipping sauce for easing keeping it up to date, plus some Ansible playbooks for installing the system images, that gets overlaid locally with the machine-specific or sensitive bits and then persisted via backups. (Heck, I had to restore from my playbook and a whole- |
It's just that I heard variations of "here is my very specific reading of rules such that mysteriously the subset of applications I care about is exempt" ... for more than 10 years. This is the library for the 99.8% of people who either want things to work consistently or do not want to care because all things work consistently. It's not the library for the 0.2% of people that have to have their own special carve-out from the standard approach and subsequently ruin things for everyone else. |
I find it convincing that Swift shares that interpretation of how the Apple guides repeatedly refer to the application's bundle ID. |
While not the official Apple sanctioned place for config files, the standard on the command line for MacOS tends to be using the Linux style
~/.config
for config files. Can we add support for using~/.config
on Mac?There is more discussion here:
https://github.com/rust-lang-nursery/cli-wg/issues/7#issuecomment-439223000
The text was updated successfully, but these errors were encountered: