fix settings path on raspi

This commit is contained in:
Dorian Zedler 2021-04-08 19:06:36 +02:00
parent 43d9f80f60
commit b801a72d29
Signed by: dorian
GPG key ID: 989DE36109AFA354

View file

@ -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"));