]> Creatis software - crea.git/blobdiff - lib/creaDevManagerLib/modelCDMAppli.cpp
Feature #1711
[crea.git] / lib / creaDevManagerLib / modelCDMAppli.cpp
index c0f37744cc76213b068fe8e8b11886afbaf1d1d4..8588123e4e3b535291763839f84dc61a559ff875 100644 (file)
@@ -34,6 +34,7 @@
 
 #include "modelCDMAppli.h"
 
+#include "CDMUtilities.h"
 #include "creaWx.h"
 #include "wx/dir.h"
 
@@ -47,10 +48,44 @@ modelCDMAppli::modelCDMAppli(const std::string& path, const int& level)
   this->name = "appli";
   this->level = level;
   this->path = path;
+
+
+
+  this->path = CDMUtilities::fixPath(path);
+  //open makelists file
+  std::string pathFixed(CDMUtilities::fixPath(path));
+
+  this->applications.clear();
+  wxDir dir(crea::std2wx((pathFixed).c_str()));
+  if (dir.IsOpened())
+    {
+      wxString fileName;
+      bool cont = dir.GetFirst(&fileName, wxEmptyString, wxDIR_DIRS);
+      while (cont)
+        {
+          std::string stdfileName = crea::wx2std(fileName);
+
+          modelCDMApplication* application = new modelCDMApplication(pathFixed + "/" + stdfileName, this->level + 1);
+          this->applications.push_back(application);
+          this->children.push_back(application);
+
+          cont = dir.GetNext(&fileName);
+        }
+
+    }
+  this->SortChildren();
 }
 
 modelCDMAppli::~modelCDMAppli()
 {
+  for (int i = 0; i < this->applications.size(); i++)
+    {
+      if(this->applications[i] != NULL)
+        {
+          delete this->applications[i];
+          this->applications[i] = NULL;
+        }
+    }
 }
 
 bool modelCDMAppli::CreateApplication(