X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcreaDevManagerLib%2FmodelCDMPackage.cpp;h=f6fc8bc703e3b7e6d83ca5ea36a05b62ad7a7a89;hb=dd9de710df141a074f10d0cab27b217425ecab20;hp=5816dc43684d60f655c4705c6f2726f7b2b797c0;hpb=e5da2a095f1be871a0489b38a060f9bfb4beb598;p=crea.git diff --git a/lib/creaDevManagerLib/modelCDMPackage.cpp b/lib/creaDevManagerLib/modelCDMPackage.cpp index 5816dc4..f6fc8bc 100644 --- a/lib/creaDevManagerLib/modelCDMPackage.cpp +++ b/lib/creaDevManagerLib/modelCDMPackage.cpp @@ -163,6 +163,8 @@ modelCDMPackage::modelCDMPackage(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") @@ -170,11 +172,23 @@ modelCDMPackage::modelCDMPackage(modelCDMIProjectTreeNode* parent, const std::st this->CMakeLists = new modelCDMCMakeListsFile(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, path + 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, path + CDMUtilities::SLASH + stdfileName, stdfileName, this->level + 1)); } - //if is an unknown file, create file + cont = dir.GetNext(&fileName); } } @@ -529,6 +543,8 @@ const bool modelCDMPackage::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") @@ -563,8 +579,22 @@ const bool modelCDMPackage::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); + } } }