on file save: create parent directories if needed
authorsheepluva
Mon, 24 Oct 2011 11:14:09 +0200
changeset 6199 582e85254110
parent 6198 9aa9ed77d63c
child 6200 6a4ace88d85a
on file save: create parent directories if needed
QTfrontend/util/HWDataManager.cpp
--- a/QTfrontend/util/HWDataManager.cpp	Mon Oct 24 10:59:52 2011 +0200
+++ b/QTfrontend/util/HWDataManager.cpp	Mon Oct 24 11:14:09 2011 +0200
@@ -25,6 +25,8 @@
 #include <QMap>
 #include <QStringList>
 
+#include <QFileInfo>
+
 #include "hwconsts.h"
 
 #include "HWDataManager.h"
@@ -99,7 +101,15 @@
                                 const QString & relativeDataFilePath) const
 {
     if (userData != NULL)
-        return userData->absolutePath()+"/"+relativeDataFilePath;
+    {
+        QString path = userData->absolutePath()+"/"+relativeDataFilePath;
+
+        // create folders if needed
+        QDir tmp;
+        tmp.mkpath(QFileInfo(path).absolutePath());
+
+        return path;
+    }
 
 
     return "";