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 the XDG Base Directory Specification #400

Closed
tengwar opened this issue Jul 7, 2017 · 8 comments · Fixed by #410
Closed

Support the XDG Base Directory Specification #400

tengwar opened this issue Jul 7, 2017 · 8 comments · Fixed by #410
Labels

Comments

@tengwar
Copy link

tengwar commented Jul 7, 2017

Currently exercism's cli client puts its config file in my $HOME. This creates a mess. The config file should go into $XDG_CONFIG_HOME. (Usually it means ~/.config/, ~/Library/Preferences/ or %APPDATA% on Linux, macOS and Windows respectively.)

The specification may seem complex, but there are simple Go libraries that implement it. For example the first google result is this lib.

@Tonkpils
Copy link
Contributor

Tonkpils commented Jul 8, 2017

@tengwar are you not seeing this behavior when using the CLI? Which version of the CLI are you using? We added XDG_CONFIG_HOME support and if it's not working as expected it is a bug, notice we are adding the config file to the XDG_CONFIG_HOME path https://github.com/exercism/cli/blob/master/paths/paths.go#L31-L42 as the default. If that variable is not set then we default to the home folder.

@Tonkpils Tonkpils added the bug? label Jul 8, 2017
@tengwar
Copy link
Author

tengwar commented Jul 13, 2017

I'm using exercism version 2.4.0. I installed it and on first run it created .exercism.json in my home folder. I noticed that I forgot to set the XDG_* variables after reinstall, but the config file should still go to ~/.config/ according to the spec:

If $XDG_CONFIG_HOME is either not set or empty, a default equal to $HOME/.config should be used.

@Tonkpils
Copy link
Contributor

I feel like the behavior in place is correct. If you set the variables after you created the config file in the home folder, we would have to fallback to home every time when attempting to read the config file if it's not at the specified place. The spec says if the variable isn't defined it'll use that and not default to home. It will only default to home if it is not set or empty.

You'd need to either copy the configuration file into your XDG path if you have that variable set, or unset that variable.

@tengwar
Copy link
Author

tengwar commented Jul 13, 2017

Normally you shouldn't touch home at all, but you already did. So yes, you would need a fallback to home for at least few releases - for backward compatibility.

I realize I now have to move this file myself, but this bug is about 2 things:

  • For new users create the config in ~/.config/ (or in $XDG_CONFIG_HOME if it's set and not empty).
  • For existing users use the file from (from most to least preferred) $XDG_CONFIG_HOME, ~/.config/ or $HOME. Perhaps also deprecate the $HOME location and warn if the config file is there.

@kytrinyx
Copy link
Member

kytrinyx commented Jul 30, 2017

I'm working a rewrite of the CLI for the new site launch, and will use the following configuration options, from most to least preferred:

  • EXERCISM_CONFIG_HOME environment variable
  • XDG_CONFIG_HOME environment variable
  • ~/.config/, or %APPDATA%

(Edited to account for the windows)

@kytrinyx
Copy link
Member

I think we've got this right in the pre-release for the 3.0.0 client. https://github.com/exercism/cli/releases/tag/v3.0.0-alpha.2

There's still a fair amount to be done before we actually launch it, but if you have a moment to verify that it does what you would expect, I'd appreciate it!

@stale
Copy link

stale bot commented Oct 17, 2017

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Oct 17, 2017
@stale stale bot closed this as completed Oct 24, 2017
@kytrinyx kytrinyx reopened this Dec 22, 2017
@stale stale bot removed the wontfix label Dec 22, 2017
@kytrinyx
Copy link
Member

I'm going to go ahead and close this one, as we've solved it for the nextercism client.

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

Successfully merging a pull request may close this issue.

3 participants