X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcreaDevManagerLib%2FmodelCDMLibrary.cpp;h=c3dcc6a00a915e3ac072ee6d334bba26cd740021;hb=dd9de710df141a074f10d0cab27b217425ecab20;hp=72310c78c3a7553e598b2867a43f9ee7e1bfad3c;hpb=e5da2a095f1be871a0489b38a060f9bfb4beb598;p=crea.git diff --git a/lib/creaDevManagerLib/modelCDMLibrary.cpp b/lib/creaDevManagerLib/modelCDMLibrary.cpp index 72310c7..c3dcc6a 100644 --- a/lib/creaDevManagerLib/modelCDMLibrary.cpp +++ b/lib/creaDevManagerLib/modelCDMLibrary.cpp @@ -120,6 +120,8 @@ modelCDMLibrary::modelCDMLibrary(modelCDMIProjectTreeNode* parent, const std::st 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") @@ -127,6 +129,17 @@ modelCDMLibrary::modelCDMLibrary(modelCDMIProjectTreeNode* parent, const std::st this->CMakeLists = new modelCDMCMakeListsFile(this, this->path + 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, this->path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1); + this->children.push_back(file); + } //if is an unknown file, create file else { @@ -295,6 +308,8 @@ const bool modelCDMLibrary::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") @@ -329,8 +344,22 @@ const bool modelCDMLibrary::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); + } } }