[vlmc-devel] Workspace: Ensure the provided path exists

Hugo Beauzée-Luyssen git at videolan.org
Mon Jan 2 23:42:19 CET 2017


vlmc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Mon Jan  2 23:32:52 2017 +0100| [9ad256c1782e6330f3b70fd53ffd2f781e6751fc] | committer: Hugo Beauzée-Luyssen

Workspace: Ensure the provided path exists

> https://code.videolan.org/videolan/vlmc/commit/9ad256c1782e6330f3b70fd53ffd2f781e6751fc
---

 src/Project/Workspace.cpp | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/Project/Workspace.cpp b/src/Project/Workspace.cpp
index eefe122..d7c6e99 100644
--- a/src/Project/Workspace.cpp
+++ b/src/Project/Workspace.cpp
@@ -34,6 +34,7 @@
 #include "Tools/VlmcDebug.h"
 
 #include <QFileInfo>
+#include <QDir>
 
 const QString   Workspace::workspacePrefix = "workspace://";
 
@@ -49,9 +50,15 @@ Workspace::Workspace(Settings *settings)
 }
 
 void
-Workspace::workspaceChanged(const QVariant &newWorkspace)
+Workspace::workspaceChanged( const QVariant &newWorkspace )
 {
-    m_workspaceDir = newWorkspace.toString();
+    QString path = newWorkspace.toString();
+    Q_ASSERT( path.isEmpty() == false );
+    m_workspaceDir = std::move( path );
+
+    QDir workspace( m_workspaceDir );
+    if ( workspace.exists() == false )
+        QDir().mkdir( m_workspaceDir );
 }
 
 bool



More information about the Vlmc-devel mailing list