summaryrefslogtreecommitdiffhomepage
path: root/options
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2019-10-30 05:38:17 +0100
committerStanislaw Halik <sthalik@misaki.pl>2019-10-30 05:38:17 +0100
commit29591277d9cae18895ef03cb858b2b327813830e (patch)
tree2543e9a2e5f3ca5133141e11b2962c26fdaf3951 /options
parentec00863aff826bc63f221136caf54da8b9285201 (diff)
options: use ~/.config on Unix
Fixes #807
Diffstat (limited to 'options')
-rw-r--r--options/globals.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/options/globals.cpp b/options/globals.cpp
index 52e198db..099a7208 100644
--- a/options/globals.cpp
+++ b/options/globals.cpp
@@ -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);
}
}