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

Change conf path XDG_CACHE_HOME to XDG_STATE_HOME #9755

Merged
12 changes: 11 additions & 1 deletion src/core/Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,17 @@ QPair<QString, QString> Config::defaultConfigFiles()
#else
// On case-sensitive Operating Systems, force use of lowercase app directories
configPath = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + "/keepassxc";
localConfigPath = QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation) + "/keepassxc";
// Qt does not support XDG_STATE_HOME yet, change this once XDG_STATE_HOME is added
QString xdgStateHome;
xdgStateHome = QFile::decodeName(qgetenv("XDG_STATE_HOME"));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Combine these two.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad, fixed with 0cd5ce4

if (!xdgStateHome.startsWith(u'/')){
xdgStateHome.clear(); // spec says relative paths should be ignored
}
if (xdgStateHome.isEmpty()) {
xdgStateHome = QDir::homePath() + "/.local/state";
}

localConfigPath = xdgStateHome + "/keepassxc";
#endif

QString suffix;
Expand Down