Skip to content
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 alternative config file locations #62

Closed
Afluttera opened this issue May 27, 2023 · 3 comments
Closed

Support alternative config file locations #62

Afluttera opened this issue May 27, 2023 · 3 comments
Labels
question Further information is requested

Comments

@Afluttera
Copy link

Afluttera commented May 27, 2023

Having a new application wanting to place it's configuration data in the users home directory is rather unfortunate, and alternative locations would be appreciated. It would be preferable if the default suggested location were to change as well, but that's not strictly necessary.

For Linux, the relevant directory for the config would be $XDG_CONFIG_HOME/rio/config.toml if XDG_CONFIG_HOME set, otherwise it's conventionally ~/.config/rio/config.toml [1]
For Windows, the directory would likely be {Home folder}/AppData/Roaming/rio/config.toml, though, I believe there may also be special ways you're suppose to access directories like that?
For Mac, it seems as though the suggested location would be ~/Library/Application Support/rio/rio.toml. I don't use a Mac, however, and found this through skimming documentation.

If backwards compatibility is a priority here, then what's typically done is that an application would first check the legacy path and load a config file there if present, and only look in subsequent paths if it isn't. This can create a bit of confusion about which is the proper one, but having multiple paths like this isn't especially unusual either, as long as the order in which paths are checked is documented.

[1] Also consider looking at the XDG Base Directory spec, which contains the proper locations of other types of data on Linux.

Thank you for your work on rio. I'm looking forward to its progress!

Edit: I just noticed themes are also loaded from that directory. I believe the locations outlined for the config file would also be correct for these theme files as well.

Edit: Actually, it seems as though this was implemented, but just reverted in commit 2044c3a? Is it intended to be kept that way?

@raphamorim
Copy link
Owner

raphamorim commented May 28, 2023

Hey there @Afluttera, thanks for bring it up and adding proper details (so gets documented for future discussions).

Yes, I really like https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html and had implemented it before as you saw in 2044c3a19546d802e640539225260306da224953. However for Mac is quite "odd" path for anyone that works mostly with terminal or comes from Linux (as my case).

I have been wondering if instead of use XDG spec blindly for all platforms, if we can have that for Windows and Linux but for MacOs use ~/.config/rio instead of ~/Library/Application Support/rio.

So would be like

  • Linux and MacOs: {$HOME}/.config/rio/config.toml
  • Windows: {$HOME}/AppData/Roaming/rio/config.toml

cc @avelino (that originally came with this discussion in #6 (comment))
ref #14

@raphamorim raphamorim added the question Further information is requested label May 28, 2023
@raphamorim
Copy link
Owner

ref: 7f147a5

@raphamorim
Copy link
Owner

For now will be closing this issue since location has updated, ref #75

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants