fix settings path on raspi
This commit is contained in:
parent
43d9f80f60
commit
b801a72d29
1 changed files with 8 additions and 4 deletions
|
@ -20,12 +20,16 @@
|
||||||
|
|
||||||
ScStwSettings::ScStwSettings(QObject *parent) : QObject(parent)
|
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);
|
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");
|
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))
|
if(!this->settingsFile->open(QFile::ReadWrite))
|
||||||
qFatal("[FATAL] Couldn't open settings file %s", qPrintable(path + "/settings.json"));
|
qFatal("[FATAL] Couldn't open settings file %s", qPrintable(path + "/settings.json"));
|
||||||
|
|
Reference in a new issue