Skip to content

Support XDG directories on macOS #117

@strega-nil

Description

@strega-nil

Hiya!

I've been going around different Rust apps that I use, and trying to fix this issue, and I noticed that this crate was reasonably official, and still broken.

The directories used right now are great for GUI apps (i.e., applications that live in /Applications), but is extremely unexpected for unix/CLI style applications. It seems really unfortunate to break people's expectations like this, especially because most people just end up using confy without thinking through the implications of a very odd configuration location.

We have a few examples of applications that used to do it the dirs way, because they just did "the default" thing, and then they've had to change to be correct:

And some examples of applications that have always used XDG on macOS (or which switched from a dotfile in the home directory to XDG when XDG became a standard), including both Rust applications and applications that are from outside the Rust ecosystem:

  • git
  • neovim
  • gcloud
  • iterm2 uses both
  • kitty
  • tmux
  • wezterm
  • dust
  • fd

Additionally, it looks like cargo will be switching to using XDG directories Soon (tm) - thread here

I will also point out that I don't think any macOS developers have ever complained about programs putting their configuration files in ~/.config – but quite a few have complained about configuration being in ~/Library/Application Support. I made the change for jj, and I have had like five people message me thanking me for fixing it. It is not expected for CLI application to put their configuration in ~/Library, and I would appreciate if the semi-official Rust stuff supported the correct paths.

Of course, for GUI applications, it may be the case that you want your configuration in ~/Library/Application Support – that means you'll likely want to still be able to put configuration there, but the default should almost certainly be in ~/.config, since the application that's likely to use confy is likely to be a CLI app.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions