zlacker

[parent] [thread] 12 comments
1. sph+(OP)[view] [source] 2022-05-11 08:57:59
AFAIK the XDG spec isn't a thing on macOS, so you get those CLI utilities written by devs on their fancy Macbook Pro that pollute your home directory, such as Deno, Doom Emacs, Elixir, Rust/Cargo, Kubernetes, npm, vscode, etc.
replies(7): >>oneeye+u6 >>indymi+Sf >>chmayn+Ig >>faho+ns >>jeroen+aX >>mmphos+MY >>sorami+FO2
2. oneeye+u6[view] [source] 2022-05-11 10:10:05
>>sph+(OP)
It's inconsistent, but certainly some programs adhere to XDG on macos. I've got pretty healthy looking ~/.config and ~/.local directories, and it's not all just my own stuff.
3. indymi+Sf[view] [source] 2022-05-11 11:40:13
>>sph+(OP)
On macos its less of a problem because the OS tries to hide your home folder and shows Documents Desktop and downloads in the Finder. Still much prefer .local and .config to a pile of dotfiles.
4. chmayn+Ig[view] [source] 2022-05-11 11:46:44
>>sph+(OP)
I notice that your comments often include trigger words/phrases like "devs on their fancy Macbook Pro". Then I realized that I do the same thing. You spot it, you got it. Maybe I'll start a 12-step group for snark addicts.
replies(1): >>sph+MH
5. faho+ns[view] [source] 2022-05-11 12:51:33
>>sph+(OP)
There is no specific reason for a program that uses the XDG dirs on other unices to not use them on macOS, other than some idea that it's "alien".

You can have ~/.config/. Nothing in macOS prevents you from having it. And so, some programs do. The worst thing that happens is that, instead of having one directoy ~/.foo you now have one directory ~/.config/foo and nothing else in ~/.config. But as soon as you add the second thing that uses ~/.config, you now have two directories in there instead of a second dotdirectory in ~.

It's just that for a bunch of them the XDG path is only used if it exists - e.g. emacs predates the spec, so it uses ~/.emacs.d (and a few others) first.

Cargo doesn't use the XDG paths at all, apparently - https://github.com/rust-lang/cargo/issues/1734. However it also needs a directory for binaries (~/.cargo/bin) and ~/.local/bin isn't actually in the spec at the moment (https://gitlab.freedesktop.org/xdg/xdg-specs/-/issues/14).

replies(2): >>sph+7J >>deadbu+RL
◧◩
6. sph+MH[view] [source] [discussion] 2022-05-11 14:09:31
>>chmayn+Ig
I'm sorry you got triggered by "devs on their fancy Macbook Pro". I don't know how you noticed this "often on my comments". Are you a fan?

It was just an observation that there are many devs writing UNIX tools on Apple hardware. There was no snark.

◧◩
7. sph+7J[view] [source] [discussion] 2022-05-11 14:14:09
>>faho+ns
> There is no specific reason for a program that uses the XDG dirs on other unices to not use them on macOS

Nobody stops Apple developers respecting a Freedesktop spec, but the point is many people that mostly know macOS probably didn't even know XDG was a thing. It's not like Apple encourages it in any of their command line utilities.

◧◩
8. deadbu+RL[view] [source] [discussion] 2022-05-11 14:25:37
>>faho+ns
It's a real shitshow.

https://wiki.archlinux.org/title/XDG_Base_Directory

9. jeroen+aX[view] [source] 2022-05-11 15:10:39
>>sph+(OP)
I can understand devs not using the right circumstances if their platform of choice doesn't come with an easy way to determine the right directory to put stuff in, let alone create it if necessary.

What I really want is an API that does "create/open/delete a file/directory for the relevant configuration/cache/resources store", be it user configured or platform default. What I get is an external package that gives me a list of potential storage locations (of which I'll probably just pick the first) that may or may not be actual directories on the system which I may or may not have access to touch files in.

Some devs are kindly reminded that there's a spec for these things but often it's too late as data is already in specific paths that users may have come to know. That way you end up with paths that get set by environment variables where you have to tell each and every program where to put their crap.

Other programs don't care enough to implement the standards (like Firefox; the bug report about XDG is old enough to vote [1] and it's still not implemented fully). Kubernetes has an open issue for its client that only ever gets bumped.

Even worse are devs that are reminded of standards like XDG and then decide to give everyone the middle finger. Snap is one of them, not only is the data directory hard-coded, it's hard-coded lowercase unlike every other standard directory on Canonical's distribution itself! Snap's biggest competitor, Flatpak, decided not following the standard is not a problem [3]. At least it's special snowflake folder starts with a period so that it's hidden by default, I suppose. Even Bash doesn't support XDG [4] because not everyone uses Linux (and apparently no effort should be made to support OS specific standards?) with the suggestion closed as won't fix.

Many tools that do support XDG only care about their own standards, of course; Windows has had SHGetKnowlFolderPath since Vista, replacing SHGetFolderLocation which dates back to Windows 2000. Still, developers like to push POSIX standards into Windows, creating .dotfiles and not even bothering to at least mark them as hidden.

There's a big list on the Arch wiki[7] listing programs and their compatibilities with XDG.

[1]: https://bugzilla.mozilla.org/show_bug.cgi?id=259356

[2]: https://github.com/kubernetes/kubernetes/issues/56402

[3]: https://github.com/flatpak/flatpak/issues/1651

[4]: https://savannah.gnu.org/support/?108134

[5]: https://docs.microsoft.com/en-us/windows/win32/api/shlobj_co...

[6]: https://docs.microsoft.com/en-us/windows/win32/api/shlobj_co...

[7]: https://wiki.archlinux.org/title/XDG_Base_Directory#Hardcode...

replies(1): >>fl0wen+071
10. mmphos+MY[view] [source] 2022-05-11 15:16:57
>>sph+(OP)
https://developer.apple.com/library/archive/documentation/Fi...
◧◩
11. fl0wen+071[view] [source] [discussion] 2022-05-11 15:52:16
>>jeroen+aX
Incidentally, did you know that PowerShell on Linux respects the XDG specification? It was rather unexpected when I first noticed it and it just tickles me pink.
replies(1): >>jeroen+8Z1
◧◩◪
12. jeroen+8Z1[view] [source] [discussion] 2022-05-11 20:07:45
>>fl0wen+071
I hate the scripting language, but technology wise Powershell is one of the most solid scripting engines out there.
13. sorami+FO2[view] [source] 2022-05-12 01:49:37
>>sph+(OP)
I haven't seen any software that conditionally disables XDG on macOS. What I do see common is software that hardcode paths. Many of these software use different paths depending on the platform. But those aren't XDG compliant because XDG paths are configurable through environment variables.

Also FYI Doom Emacs is currently XDG compliant.

[go to top]