Skip to content

Expose XDG conventions on macOS #45

@xvxx

Description

@xvxx

Hi there, and thank you for this crate.

macOS is in the weird position of having its own conventions for Mac apps, but also being a UNIX system. A lot of programs developers install aren’t exclusively Mac programs, but also work on Linux, BSDs, etc.

For example, the fish shell, mpv, spotify-tui, GitHub’s “hub”, and the kitty terminal are a few I use personally on Linux and Mac. On both OSes they all put their config files in the same place: ~/.config.

Meanwhile, the ~/Library/Application Support directory on my Mac seems to be exclusively used by native Mac applications. Applications that I would launch through the GUI, and which aren’t in my $PATH.

It would be great if this crate made the XDG conventions available on Macs too, so developers using this crate have the option of which to use. I have a silly little Gopher client, phetch, that runs on Linux and Mac. It uses ~/.config/phetch, which plays nicely with the tools I listed above and is convenient for version control, discovery, etc. I’m not able to use this crate, because on Mac the config dir would be ~/Library/Application Support/phetch.

I’ve also run into this while contributing to the Blightmud MUD client, which initially kept its config in ~/Library/Application Support/blightmud. In that case, your config files are mostly Lua scripts - code that you want to add to or change regularly - and the application isn’t specific to macOS. We eventually switched to ~/.config/blightmud so it’s the same on *nix and Mac, but we couldn’t find a way to make that change while continuing to use dirs-next.

If the option of which to use were made available to developers, I imagine the thought process would go something like: If you’re building a native Mac application that’ll live in /Applications and has a GUI, you use the Apple guidelines (like ~/Library/Application Support). However, if you’re building a UNIX application that isn’t specific to Mac, you could use the XDG conventions.

While my request may seem to go against the Standard Directories guidelines that Apple provides, I think it’s actually true to the guidelines because of the first entry:

/Applications    This directory is where you install apps intended for use by all users of a computer

In other words, I believe that the guidelines are for native Mac applications that live in /Applications. Random UNIX utilities like ytop and bandwhich and mpv don’t need to follow these guidelines, and in fact it adds a bit of friction when they do. It would be great if they could also make use of this crate.

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-enhancementCategory: a PR with an enhancement or an issue tracking an accepted enhancementC-proposalCategory: a proposal for something we might want to do, or maybe not; details still being worked outE-help-wantedAn issue where some help would be really appreciated. :)I-needs-decisionInfo: Need to discuss and decide

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions