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

Feature request: either obey XDG fs paths, or let us override MACKUP_CONFIG_FILE, CUSTOM_APPS_DIR #473

Open
kergoth opened this issue Feb 20, 2015 · 13 comments
Labels

Comments

@kergoth
Copy link

kergoth commented Feb 20, 2015

See http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html. ~/.config/mackup/* would be ideal, rather than cluttering up the homedir with yet another dotfile.

@mwilliammyers
Copy link
Contributor

huge 👍

@lra
Copy link
Owner

lra commented Aug 10, 2015

So mackup should look at the $XDG_CONFIG_HOME env var and try to look for the .mackup.cfg and all the custom application files? All in addition to the usual $HOME place?

Makes sense?

@mwilliammyers
Copy link
Contributor

It would be either/or:
So if $XDG_CONFIG_HOME is set it would look at: $XDG_CONFIG_HOME/mackup/mackup.cfg (notice these files/dirs are not invisible), if it is not set, then it will look at: $HOME/.mackup.cfg. I'm wondering how the ~/.mackup directory (for custom app.cfg files or to override default app.cfg files) would be represented as well... Maybe they would just be in $XDG_CONFIG_HOME/mackup alongside mackup.cfg?

See the --global option under the git docs for a good example of how they obey the XDG spec.

@lra
Copy link
Owner

lra commented Aug 10, 2015

Ok then:

  1. try $XDG_CONFIG_HOME/mackup/ and $XDG_CONFIG_HOME/mackup.cfg if they exist.
  2. if not, try $HOME/.mackup/ and $HOME/.mackup.cfg
  3. if not, no config.

Make sense?

@kergoth
Copy link
Author

kergoth commented Aug 10, 2015

Sounds reasonable to me.

@mwilliammyers
Copy link
Contributor

It is customary for every app/package to have their own directory in $XDG_CONFIG_HOME (or any other XDG directory), so it would be:

  1. try $XDG_CONFIG_HOME/mackup/ and $XDG_CONFIG_HOME/mackup/mackup.cfg if they exist.
  2. if not, try $HOME/.mackup/ and $HOME/.mackup.cfg
  3. if not, no config.

That way the only directory mackup ever interfaces with is: $XDG_CONFIG_HOME/mackup/

I love this package by the way. Nice work!

@lra
Copy link
Owner

lra commented Aug 10, 2015

Can't we have 2 things: the mackup config .mackup.cfg and the custom application database, mackup/*. But in the custom application database, there can be one for mackup, so in your suggestion, mackup/mackup.cfg would lead to bothe the mackup config, and the application database entry for mackup.

Unless we move everything one level deeper, e.g.$XDG_CONFIG_HOME/mackup/mackup/* =(

Can you link to any reference to this "customary" behavior?

@mwilliammyers
Copy link
Contributor

Am I understanding you correctly that, as it stands right now does it:

  1. try: $HOME/.mackup/mackup.cfg
  2. if not, try:$HOME/.mackup.cfg
  3. if not, no config.

If you want to keep it consistent between XDG and non XDG, it could behave like your original suggestion:

  1. try $XDG_CONFIG_HOME/mackup/ and $XDG_CONFIG_HOME/mackup.cfg if they exist.
  2. if not, try $HOME/.mackup/ and $HOME/.mackup.cfg
  3. if not, no config.

@lra
Copy link
Owner

lra commented Aug 10, 2015

No, $HOME/.mackup/mackup.cfg and $HOME/.mackup.cfg are 2 different things.
The former is a custom app database entry for mackup, the later is the mackup config.

@mwilliammyers
Copy link
Contributor

Ok that makes a lot more sense.
Then you original suggestion:

  1. try $XDG_CONFIG_HOME/mackup/ and $XDG_CONFIG_HOME/mackup.cfg if they exist.
  2. if not, try $HOME/.mackup/ and $HOME/.mackup.cfg
  3. if not, no config.

is definitely the way to go.

So basically: $HOME is interchangeable with $XDG_CONFIG_HOME except that in $XDG_CONFIG_HOME you don't hide the directories or files...

@lra
Copy link
Owner

lra commented Aug 10, 2015

ok let's do it then, PR welcome ;)

@mwilliammyers
Copy link
Contributor

Awesome, Ill see if I can do a PR soon

@NorthIsUp
Copy link

added this #1987

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

No branches or pull requests

4 participants