Skip to content

Commit

Permalink
options: use ~/.config on Unix
Browse files Browse the repository at this point in the history
Fixes #807
  • Loading branch information
sthalik committed Oct 30, 2019
1 parent ec00863 commit 2959127
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions options/globals.cpp
Expand Up @@ -151,11 +151,20 @@ fail: constexpr const char* subdir = "ini";
}
else
{
const QString dir = QStandardPaths::standardLocations(QStandardPaths::DocumentsLocation).value(0, QString());
QString dir = QStandardPaths::standardLocations(QStandardPaths::DocumentsLocation).value(0, QString());
if (dir.isEmpty())
goto fail;
#if !defined _WIN32 && !defined __APPLE__
const QString fmt = QStringLiteral("%1/%2");
if (!QFile::exists(fmt.arg(dir, OPENTRACK_ORG)))
{
dir = QStandardPaths::standardLocations(QStandardPaths::ConfigLocation).value(0, QString());
if (dir.isEmpty())
goto fail;
}
#endif
(void)QDir(dir).mkpath(OPENTRACK_ORG);
return QStringLiteral("%1/%2").arg(dir, OPENTRACK_ORG);
return fmt.arg(dir, OPENTRACK_ORG);
}
}

Expand Down

0 comments on commit 2959127

Please sign in to comment.