]> Creatis software - crea.git/blobdiff - lib/creaDevManagerLib/modelCDMFolder.cpp
Feature #1711 CreaDevManager application implementation
[crea.git] / lib / creaDevManagerLib / modelCDMFolder.cpp
index bcef483f2c6146028430e6baf83e3ca098cee4c7..c2796e8cfa0f6891eae459ea718cef7e4d8a3b3f 100644 (file)
@@ -83,6 +83,8 @@ modelCDMFolder::modelCDMFolder(modelCDMIProjectTreeNode* parent, const std::stri
       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")
@@ -90,11 +92,23 @@ modelCDMFolder::modelCDMFolder(modelCDMIProjectTreeNode* parent, const std::stri
               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 code file
+          else if(fileType == ".c" ||
+              fileType == ".cxx" ||
+              fileType == ".h" ||
+              fileType == ".cpp" ||
+              fileType == ".txx" ||
+              fileType == ".cmake" )
+            {
+              modelCDMCodeFile* file = new modelCDMCodeFile(this, pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1);
+              this->children.push_back(file);
+            }
+          //if is an unknown file, create file
           else
             {
               this->children.push_back(new modelCDMFile(this, pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1));
             }
-          //if is an unknown file, create file
+
           cont = dir.GetNext(&fileName);
         }
     }
@@ -211,6 +225,8 @@ const bool modelCDMFolder::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")
@@ -246,8 +262,22 @@ const bool modelCDMFolder::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 is a code file, create modelCDMCodeFile
+                  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);
+                    }
                 }
             }