From 29591277d9cae18895ef03cb858b2b327813830e Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Wed, 30 Oct 2019 05:38:17 +0100 Subject: options: use ~/.config on Unix Fixes #807 --- options/globals.cpp | 13 +++++++++++-- 1 file 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); } } -- cgit v1.2.3