]> Creatis software - crea.git/blobdiff - lib/creaDevManagerLib/modelCDMAppli.cpp
Feature #1711
[crea.git] / lib / creaDevManagerLib / modelCDMAppli.cpp
index c92932a1c5583de3c0a9f6795d926fefe26cc13d..417392792399e8024b7eed70ae5b7101c762f655 100644 (file)
@@ -69,9 +69,17 @@ modelCDMAppli::modelCDMAppli(const std::string& path, const std::string& name, c
         {
           std::string stdfileName = crea::wx2std(fileName);
 
-          modelCDMApplication* application = new modelCDMApplication(pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1);
-          this->applications.push_back(application);
-          this->children.push_back(application);
+          if(stdfileName != "template_appli" && stdfileName != "template_wx_appli")
+            {
+              modelCDMApplication* application = new modelCDMApplication(pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1);
+              this->applications.push_back(application);
+              this->children.push_back(application);
+            }
+          else
+            {
+              modelCDMFolder* folder = new modelCDMFolder(pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1);
+              this->children.push_back(folder);
+            }
 
           cont = dir.GetNext(&fileName);
         }
@@ -175,26 +183,51 @@ const bool modelCDMAppli::Refresh(std::string*& result)
       while (cont)
         {
           std::string stdfileName = crea::wx2std(fileName);
-          std::string applicationName = stdfileName;
-          //check if they already exist
-          bool found = false;
-          for (int i = 0; !found && i < this->applications.size(); i++)
+
+          if(stdfileName != "template_appli" && stdfileName != "template_wx_appli")
             {
-              if (this->applications[i]->GetName() == applicationName)
+              std::string applicationName = stdfileName;
+              //check if application already exist
+              bool found = false;
+              for (int i = 0; !found && i < this->applications.size(); i++)
                 {
-                  found = true;
-                  int pos = std::find(this->children.begin(), this->children.end(), this->applications[i]) - this->children.begin();
-                  checked[pos] = true;
-                  checkedApplications[i] = true;
-                  if(!this->applications[i]->Refresh(result))
-                    return false;
+                  if (this->applications[i]->GetName() == applicationName)
+                    {
+                      found = true;
+                      int pos = std::find(this->children.begin(), this->children.end(), this->applications[i]) - this->children.begin();
+                      checked[pos] = true;
+                      checkedApplications[i] = true;
+                      if(!this->applications[i]->Refresh(result))
+                        return false;
+                    }
+                }
+              if(!found)
+                {
+                  modelCDMApplication* application= new modelCDMApplication(this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1);
+                  this->applications.push_back(application);
+                  this->children.push_back(application);
                 }
             }
-          if(!found)
+          else
             {
-              modelCDMApplication* application= new modelCDMApplication(this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1);
-              this->applications.push_back(application);
-              this->children.push_back(application);
+              //check if folder already exist
+              bool found = false;
+              for (int i = 0; !found && i < this->children.size(); i++)
+                {
+                  if (this->children[i]->GetName() == stdfileName)
+                    {
+                      found = true;
+                      checked[i] = true;
+
+                      if(!this->children[i]->Refresh(result))
+                        return false;
+                    }
+                }
+              if(!found)
+                {
+                  modelCDMFolder* folder= new modelCDMFolder(this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1);
+                  this->children.push_back(folder);
+                }
             }
           cont = dir.GetNext(&fileName);
         }