X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcreaDevManagerLib%2FmodelCDMProject.cpp;h=7d0b454eda24c40272a78d8ef410d77dfac711aa;hb=dd9de710df141a074f10d0cab27b217425ecab20;hp=7edde9ad3738891b6aba77479c0084c5c7068be6;hpb=e5da2a095f1be871a0489b38a060f9bfb4beb598;p=crea.git diff --git a/lib/creaDevManagerLib/modelCDMProject.cpp b/lib/creaDevManagerLib/modelCDMProject.cpp index 7edde9a..7d0b454 100644 --- a/lib/creaDevManagerLib/modelCDMProject.cpp +++ b/lib/creaDevManagerLib/modelCDMProject.cpp @@ -189,6 +189,8 @@ modelCDMProject::modelCDMProject( 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") @@ -196,11 +198,23 @@ modelCDMProject::modelCDMProject( 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 { 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); } } @@ -629,6 +643,8 @@ const bool modelCDMProject::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") @@ -646,6 +662,7 @@ const bool modelCDMProject::Refresh(std::string*& result) return false; } } + //if is a code file, create modelCDMCodeFile //if is an unknown file, create file else { @@ -663,8 +680,21 @@ const bool modelCDMProject::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); + } } }