One version for creating the directory is enough :)
authorgregor herrmann <gregoa@debian.org>
Thu, 6 Sep 2012 07:13:31 +0000 (07:13 +0000)
committergregor herrmann <gregoa@debian.org>
Thu, 6 Sep 2012 07:13:31 +0000 (07:13 +0000)
(Now tested on Windows, too.)

src/sql/sqlengine.cpp

index 62d27e3..f092dba 100644 (file)
@@ -48,14 +48,8 @@ SqlEngine::~SqlEngine() {
 void SqlEngine::open() {
     // we may have to create the directory of the database
     QFileInfo dbFilenameInfo(dbFilename);
-
-    // First possibility (works with Linux, not tested on Windows:
-    // QDir cwd;
-    // cwd.mkpath(dbFilenameInfo.absolutePath());
-
-    // Second possibility (works on Windows)
-    dbFilenameInfo.absoluteDir().mkpath(".");
-
+    QDir cwd;
+    cwd.mkpath(dbFilenameInfo.absolutePath());
     // We don't have to handle errors because in worst case, opening the database will fail
     // and db.isOpen() returns false.
     db = QSqlDatabase::addDatabase("QSQLITE");