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

[PATCH] Follow XDG Base Directory spec on Linux #1624

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

polirritmico
Copy link

Fix #643. Uses QStandardPaths to get cache, data and config XDG folders only on Linux. If old folder (e.g. ~/.hydrogen/) is found, use that instead of the XDG paths. If no folder is found, create the XDG dirs.

According to https://doc.qt.io/qt-5/qstandardpaths.html this should be the default paths returned by QStandardPaths (Follow the ENV paths configured by the user):

QStandardPaths Linux Path
AppConfigLocation ~/.config/hydrogen
AppLocalDataLocation ~/.local/share/hydrogen
CacheLocation ~/.cache/hydrogen

The __usr_*_paths are setted outside a function, so QStandardPaths isn't avaliable to get the XDG paths. Also no APPNAME is avaliable until setApplicationName() is called after the Filesystem::check_usr_paths() is used. To avoid this update_usr_paths() is added at the begining of check_usr_paths() to update the correct values from QStandardPaths.

Uses QStandardPaths to get cache, data and config XDG folders.
The config file go to $XDG_CONFIG_HOME/hydrogen/hydrogen.conf
The cache folder go to $XDG_CACHE_HOME/hydrogen/
And all the data subfolders (drumkits, plugins, playlists, etc.) go to
$XDG_DATA_HOME/hydrogen/ along with the hydrogen.log file.

If old folder (~/.hydrogen/) is found, use that instead of the XDG paths.

The __usr_*_paths are setted outside a function, so QStandardPaths isn't
avaliable to get the XDG paths. Also no APPNAME is avaliable until
setApplicationName() is called after the Filesystem::check_usr_paths()
is used. To avoid this update_usr_paths() is added at the begining of
check_usr_paths() to update the correct values from QStandardPaths.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

~/.hydrogen does not follow XDG standards
1 participant