]> Creatis software - crea.git/blobdiff - lib/creaDevManagerLib/modelCDMFolder.cpp
Feature #1711 CreaDevManager application implementation
[crea.git] / lib / creaDevManagerLib / modelCDMFolder.cpp
index c2796e8cfa0f6891eae459ea718cef7e4d8a3b3f..6195892450508190751bd6c2d9f46d64227594d9 100644 (file)
@@ -83,8 +83,14 @@ modelCDMFolder::modelCDMFolder(modelCDMIProjectTreeNode* parent, const std::stri
       while (cont)
         {
           std::string stdfileName = crea::wx2std(fileName);
+          std::cout << "analyzing " << stdfileName << std::endl;
           std::size_t fileTypePos = stdfileName.find_last_of(".");
-          std::string fileType = stdfileName.substr(fileTypePos);
+          std::string fileType;
+          if(fileTypePos != std::string::npos)
+            fileType = stdfileName.substr(fileTypePos);
+          else
+            fileType = "";
+          std::cout << "fileType: " << fileType <<std::endl;
 
           //if CMakeLists, create CMakeLists
           if(stdfileName == "CMakeLists.txt")
@@ -103,6 +109,18 @@ modelCDMFolder::modelCDMFolder(modelCDMIProjectTreeNode* parent, const std::stri
               modelCDMCodeFile* file = new modelCDMCodeFile(this, pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1);
               this->children.push_back(file);
             }
+          //if is a bbs file, create bbs file
+          else if(fileType == ".bbs")
+            {
+              modelCDMBBSFile* file = new modelCDMBBSFile(this, pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1);
+              this->children.push_back(file);
+            }
+          //if is a bbg file, create bbg file
+          else if(fileType == ".bbg")
+            {
+              modelCDMBBGFile* file = new modelCDMBBGFile(this, pathFixed + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1);
+              this->children.push_back(file);
+            }
           //if is an unknown file, create file
           else
             {
@@ -226,7 +244,11 @@ const bool modelCDMFolder::Refresh(std::string*& result)
         {
           std::string stdfileName = crea::wx2std(fileName);
           std::size_t fileTypePos = stdfileName.find_last_of(".");
-          std::string fileType = stdfileName.substr(fileTypePos);
+          std::string fileType;
+          if(fileTypePos != std::string::npos)
+            fileType = stdfileName.substr(fileTypePos);
+          else
+            fileType = "";
 
           //if CMakeLists, create CMakeLists
           if(stdfileName == "CMakeLists.txt")
@@ -273,6 +295,17 @@ const bool modelCDMFolder::Refresh(std::string*& result)
                     {
                       this->children.push_back(new modelCDMCodeFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1));
                     }
+                  //if is a bbs file, create modelCDMBBSFile
+                  else if(fileType == ".bbs")
+                    {
+                      this->children.push_back(new modelCDMBBSFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1));
+                    }
+                  //if is a bbg file, create modelCDMBBGFile
+                  else if(fileType == ".bbg")
+                    {
+                      this->children.push_back(new modelCDMBBGFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1));
+                    }
+                  //if is an unknown file, create modelCDMFile
                   else
                     {
                       modelCDMFile* file = new modelCDMFile(this, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1);