summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Gottfried <sebastiangottfried@web.de>2015-06-02 13:39:37 (GMT)
committerSebastian Gottfried <sebastiangottfried@web.de>2015-06-02 13:39:37 (GMT)
commit442b70c94757cb1ef162120f7009e2761b5520c5 (patch)
tree8f8449a67ef99214a72be22bf0f1665351adb199
parent594617c89af8abca238f9e77c7b9b1ab0ec4e8c0 (diff)
Qt5: Fix DB File Access
-rw-r--r--src/core/dbaccess.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/core/dbaccess.cpp b/src/core/dbaccess.cpp
index f8b8e09..4f4dae0 100644
--- a/src/core/dbaccess.cpp
+++ b/src/core/dbaccess.cpp
@@ -18,6 +18,7 @@
#include "dbaccess.h"
#include <QDebug>
+#include <QDir>
#include <QUuid>
#include <QSqlDatabase>
#include <QSqlQuery>
@@ -42,7 +43,12 @@ QSqlDatabase DbAccess::database()
{
if (!QSqlDatabase::contains(QSqlDatabase::defaultConnection))
{
- QString dbPath = QStandardPaths::locate(QStandardPaths::DataLocation, "profiles.db");
+ QDir dataDir = QDir(QStandardPaths::writableLocation(QStandardPaths::DataLocation));
+ if (!dataDir.exists())
+ {
+ dataDir.mkpath(dataDir.path());
+ }
+ QString dbPath = dataDir.filePath("profiles.db");
QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
db.setDatabaseName(dbPath);
if (!db.open())