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

Chatty config-, cache- and data-directories on Linux #273

Open
bastimeyer opened this issue Aug 13, 2018 · 2 comments · May be fixed by #472
Open

Chatty config-, cache- and data-directories on Linux #273

bastimeyer opened this issue Aug 13, 2018 · 2 comments · May be fixed by #472
Labels
Enhancement Under Advisement This is being considered for how feasible it is or how it could be implemented

Comments

@bastimeyer
Copy link

bastimeyer commented Aug 13, 2018

Please consider using the correct config-, cache- and data-directories on Linux, as defined by the XDG Base Directory Specification:
https://specifications.freedesktop.org/basedir-spec/latest/index.html
https://specifications.freedesktop.org/basedir-spec/latest/ar01s03.html

Instead of using $HOME/.chatty and polluting the user's home directory, please

  • move the config files to $XDG_CONFIG_HOME/chatty ($HOME/.config/chatty),
  • move the cache files to $XDG_CACHE_HOME/chatty ($HOME/.cache/chatty) and
  • move the data files to $XDG_DATA_HOME/chatty ($HOME/.local/share/chatty).

Thanks!

@tduva
Copy link
Contributor

tduva commented Oct 18, 2018

Is this the same on all Linux variants?

What do you consider data files?

@bastimeyer
Copy link
Author

bastimeyer commented Oct 18, 2018

Is this the same on all Linux variants?

It doesn't matter if this freedesktop specification is not supported on a user's system. It's more or less just a suggestion on how to organize files in the user's home directory. You can and should always use fallback paths if the env vars are not set, which is even the default on most distros. An algorithm like this will work as a migration path for all of the env vars.

# just an example regarding the config files

# use "${HOME}/.config" as fallback path if "${XDG_CONFIG_HOME}" is empty
CONFIG_DIR="${XDG_CONFIG_HOME:-${HOME}/.config}"

if [ -d "${CONFIG_DIR}/chatty" ]; then
  # if "${CONFIG_DIR}/chatty" exists, use it
else if [ -d "${HOME}/.chatty" ]; then
  # if "${HOME}/.chatty" exists, read files from there, but write new files into "${CONFIG_DIR}/chatty"
else
  # create "${CONFIG_DIR}/chatty"
fi

What do you consider data files?

The definition is a bit blurry here and there are already suggestions to further split it up with the introduction of another "state" env var, but for now you can treat data files as files which are neither config files nor explicit cache files, like log files for example. Data files are user-specific files similar to the system's /usr/share directory.

See the table at the bottom of the Debian wiki:
https://wiki.debian.org/XDGBaseDirectorySpecification

Or see the Arch Linux wiki which also includes a list of applications which have migrated in the past:
https://wiki.archlinux.org/index.php/XDG_Base_Directory

@tduva tduva added Enhancement Under Advisement This is being considered for how feasible it is or how it could be implemented labels May 4, 2020
@yoshiyoshyosh yoshiyoshyosh linked a pull request Jul 7, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Under Advisement This is being considered for how feasible it is or how it could be implemented
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants