]> Creatis software - crea.git/blobdiff - lib/creaDevManagerLib/modelCDMAppli.cpp
Feature #1711
[crea.git] / lib / creaDevManagerLib / modelCDMAppli.cpp
index ee7edc1d54851f82279ce5cb791bbda2d7f820b0..2bba913c0f7b98255fe3b77ff0a3a29915d22937 100644 (file)
 
 #include "modelCDMAppli.h"
 
+#include "CDMUtilities.h"
+#include "creaWx.h"
+#include "wx/dir.h"
+
 modelCDMAppli::modelCDMAppli()
 {
 }
 
+modelCDMAppli::modelCDMAppli(const std::string& path, const int& level)
+{
+  this->type = wxDIR_DIRS;
+  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()
 {
 }
@@ -58,7 +96,7 @@ bool modelCDMAppli::OpenCMakeListsFile(std::string*& result)
   return true;
 }
 
-bool modelCDMAppli::Refresh(std::string*& result)
+const bool modelCDMAppli::Refresh(std::string*& result)
 {
   //TODO: implement method
   return true;