]> Creatis software - crea.git/blobdiff - lib/creaDevManagerLib/modelCDMAppli.cpp
Feature #1711 CreaDevManager application implementation
[crea.git] / lib / creaDevManagerLib / modelCDMAppli.cpp
index c66cbb871beb6deabfe5d74d36f31cbf7ee1d203..70471a785dc60e13d4b5b089a9dcabc7676f16f4 100644 (file)
@@ -90,6 +90,8 @@ modelCDMAppli::modelCDMAppli(modelCDMIProjectTreeNode* parent, const std::string
       while (cont)
         {
           std::string stdfileName = crea::wx2std(fileName);
+          std::size_t fileTypePos = stdfileName.find_last_of(".");
+          std::string fileType = stdfileName.substr(fileTypePos);
 
           //if CMakeLists, create CMakeLists
           if(stdfileName == "CMakeLists.txt")
@@ -97,6 +99,17 @@ modelCDMAppli::modelCDMAppli(modelCDMIProjectTreeNode* parent, const std::string
               this->CMakeLists = new modelCDMCMakeListsFile(this, pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1);
               this->children.push_back(this->CMakeLists);
             }
+          //if is a code file, create modelCDMCodeFile
+          else if(
+              fileType == ".c" ||
+              fileType == ".cxx" ||
+              fileType == ".h" ||
+              fileType == ".cpp" ||
+              fileType == ".txx" ||
+              fileType == ".cmake" )
+            {
+              this->children.push_back(new modelCDMCodeFile(this, pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1));
+            }
           //if is an unknown file, create file
           else
             {
@@ -344,6 +357,8 @@ const bool modelCDMAppli::Refresh(std::string*& result)
       while (cont)
         {
           std::string stdfileName = crea::wx2std(fileName);
+          std::size_t fileTypePos = stdfileName.find_last_of(".");
+          std::string fileType = stdfileName.substr(fileTypePos);
 
           //if CMakeLists, create CMakeLists
           if(stdfileName == "CMakeLists.txt")
@@ -361,6 +376,7 @@ const bool modelCDMAppli::Refresh(std::string*& result)
                     return false;
                 }
             }
+          //if is a code file, create modelCDMCodeFile
           //if is an unknown file, create file
           else
             {
@@ -378,8 +394,21 @@ const bool modelCDMAppli::Refresh(std::string*& result)
 
               if(!found)
                 {
-                  modelCDMFile* file = new modelCDMFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1);
-                  this->children.push_back(file);
+                  if(
+                    fileType == ".c" ||
+                    fileType == ".cxx" ||
+                    fileType == ".h" ||
+                    fileType == ".cpp" ||
+                    fileType == ".txx" ||
+                    fileType == ".cmake" )
+                    {
+                      this->children.push_back(new modelCDMCodeFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1));
+                    }
+                  else
+                    {
+                      modelCDMFile* file = new modelCDMFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1);
+                      this->children.push_back(file);
+                    }
                 }
             }