Create the path of the settings database if it doesn't exist yet

Otherwise creation of the database fails on the first startup...
This commit is contained in:
Thorbjørn Lindeijer
2009-06-12 14:51:01 +02:00
parent f5e7fb9cbb
commit 20a270e4ae

View File

@@ -29,6 +29,7 @@
#include "settingsdatabase.h"
#include <QtCore/QDir>
#include <QtCore/QMap>
#include <QtSql/QSqlDatabase>
#include <QtSql/QSqlError>
@@ -94,6 +95,10 @@ SettingsDatabase::SettingsDatabase(const QString &path,
const QLatin1Char slash('/');
// TODO: Don't rely on a path, but determine automatically
QDir pathDir(path);
if (!pathDir.exists())
pathDir.mkpath(pathDir.absolutePath());
QString fileName = path;
if (!fileName.endsWith(slash))
fileName += slash;