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

XDG Base Directory Specification #338

Open
carlwgeorge opened this issue Sep 18, 2015 · 3 comments
Open

XDG Base Directory Specification #338

carlwgeorge opened this issue Sep 18, 2015 · 3 comments

Comments

@carlwgeorge
Copy link

Please consider following the XDG Base Directory Specification. This means that the default configuration directory would change from ~/.rack to ~/.config/rack, and would be relocatable based on the environment variable XDG_CONFIG_HOME.

If this is not acceptable, please consider letting users override the default location with a custom environment variable, similar to how gnupg (GNUPGHOME) or httpie (HTTPIE_CONFIG_DIR) allow it.

@rgbkrk
Copy link
Contributor

rgbkrk commented Sep 19, 2015

While maintaining projects that use the XDG Base Directory Specification, I've not enjoyed the multi-level documentation that goes with it when working across all the Operating Systems (Windows, OS X, FreeBSD, and Linux).

If this is not acceptable, please consider letting users override the default location with a custom environment variable, similar to how gnupg (GNUPGHOME) or httpie (HTTPIE_CONFIG_DIR) allow it.

If you're open to writing PRs for it and seeing what people think, I'm open to reviewing it.

How does the XDG Base Directory Specification work with Windows users?

@carlwgeorge
Copy link
Author

It is absolutely a Linux specific solution. That said, check out how @ActiveState has approached this with their appdirs Python module. They have done the leg work to find all the corresponding directories on Linux, Mac, and Windows for user's data, configuration, and cache.

OS data
Linux $XDG_DATA_HOME or ~/.local/share/<AppName>
OSX ~/Library/Application Support/<AppName>
Windows C:\Users\<username>\AppData\Local\<AppAuthor>\<AppName>
OS configuration
Linux $XDG_CONFIG_HOME or ~/.config/<AppName>
OSX ~/Library/Application Support/<AppName>
Windows C:\Users\<username>\AppData\Local\<AppAuthor>\<AppName>
OS cache
Linux $XDG_CACHE_HOME or ~/.cache/<AppName>
OSX ~/Library/Caches/<AppName>
Windows C:\Users\<username>\AppData\Local\<AppAuthor>\<AppName>\Cache

I think following each OS's standards offers significant benefits over just using $HOME/.rack everywhere.

  • less cluttered $HOME directory
  • easier to back up data (while ignoring cache files)
  • easier to clear cache
  • easier to reset an application to the default configuration just by deleting configuration files only (Linux only)
  • ability to manage configuration (small files) in version control, independently of data (possibly large files) and cache (not important) (Linux only)

More info:
http://ploum.net/post/207-modify-your-application-to-use-xdg-folders
https://wiki.gnome.org/action/show/Initiatives/GnomeGoals/XDGConfigFolders

I would love to send a pull request, but I've never written Go before. If the project is interested in going down this path, I can certainly try.

@jrperritt
Copy link
Contributor

To be clear, I think we'd be open to reviewing a PR that allows users to set the rack directory via environment variable.

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

No branches or pull requests

3 participants