From b801a72d29285d43eb0f5ef788285939b28821e5 Mon Sep 17 00:00:00 2001 From: Dorian Zedler Date: Thu, 8 Apr 2021 19:06:36 +0200 Subject: [PATCH] fix settings path on raspi --- ScStwLibraries/sources/scstwsettings.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/ScStwLibraries/sources/scstwsettings.cpp b/ScStwLibraries/sources/scstwsettings.cpp index 6f39147..d0b21b9 100644 --- a/ScStwLibraries/sources/scstwsettings.cpp +++ b/ScStwLibraries/sources/scstwsettings.cpp @@ -20,12 +20,16 @@ ScStwSettings::ScStwSettings(QObject *parent) : QObject(parent) { - QString path = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation); +#ifdef RASPI + QString path = "/root/.config/ScStwBasestation"; +#else + QString path = QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation); +#endif QDir dir(path); + if(!dir.mkpath(path)) + qFatal("[FATAL] Failed to create writable directory for settings at %s", qPrintable(path)); + this->settingsFile = new QFile(path + "/settings.json"); - if(!this->settingsFile->exists()) - if(!dir.mkpath(path)) - qFatal("[FATAL] Couldn't create settings dir %s", qPrintable(path)); if(!this->settingsFile->open(QFile::ReadWrite)) qFatal("[FATAL] Couldn't open settings file %s", qPrintable(path + "/settings.json"));