X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcreaDevManagerLib%2FmodelCDMMain.cpp;h=7537c467087aa819e3d804f167e574ada9dddbe0;hb=311bdcc514f85386f3bbbef9ff6a88bf69fd930f;hp=bb37b3d93acb0a7b94a02c0a6b84779f09d5ac43;hpb=73787c5a26e6b218b9e6c716dafc7d16330441e7;p=crea.git diff --git a/lib/creaDevManagerLib/modelCDMMain.cpp b/lib/creaDevManagerLib/modelCDMMain.cpp index bb37b3d..7537c46 100644 --- a/lib/creaDevManagerLib/modelCDMMain.cpp +++ b/lib/creaDevManagerLib/modelCDMMain.cpp @@ -83,8 +83,8 @@ bool modelCDMMain::CreateProject( std::string command2("del "); command += "\"" + locationFixed + "\" \"" + name + "\""; - command1 += "\"" + locationFixed +"\\"+name+"\\CMakeLists.txt.in\" " + "NameOfTheProject " + name + "> \"" + locationFixed + "\\" + name + "\\CMakeLists.txt\""; - command2 += "\"" + locationFixed +"\\"+name+"\\CMakeLists.txt.in\""; + command1 += "\"" + locationFixed +CDMUtilities::SLASH+name+CDMUtilities::SLASH+"CMakeLists.txt.in\" " + "NameOfTheProject " + name + "> \"" + locationFixed + CDMUtilities::SLASH + name + CDMUtilities::SLASH + "CMakeLists.txt\""; + command2 += "\"" + locationFixed +CDMUtilities::SLASH+name+CDMUtilities::SLASH+"CMakeLists.txt.in\""; if (system (command.c_str())) @@ -97,21 +97,21 @@ bool modelCDMMain::CreateProject( system ( command2.c_str() ); char *author = author.c_str(); - std::string nomDirectory = locationFixed + "\\" + name; - std::string nomPackageDirectory = nomDirectory + "\\" + "bbtk_" + name + "_PKG"; + std::string nomDirectory = locationFixed + CDMUtilities::SLASH + name; + std::string nomPackageDirectory = nomDirectory + CDMUtilities::SLASH + "bbtk_" + name + "_PKG"; std::string bbCreatePackage("bbCreatePackage "); - bbCreatePackage += nomDirectory + " " + name + " " + author + " " + description; + bbCreatePackage += "\"" + nomDirectory + "\" \"" + name + "\" \"" + author + "\" \"" + description + "\""; system (bbCreatePackage.c_str()); std::string add; - add = "echo ADD_SUBDIRECTORY(bbtk_" + name + "_PKG) >> " + nomDirectory + "/CMakeLists.txt"; + add = "echo ADD_SUBDIRECTORY(bbtk_" + name + "_PKG) >> \"" + nomDirectory + CDMUtilities::SLASH + "CMakeLists.txt\""; system(add.c_str()); - this->project = new modelCDMProject(nomDirectory); + this->project = new modelCDMProject(nomDirectory, name); #else // ------ LINUX / MacOS std::string command("creaNewProject.sh "); - command += "\"" + locationFixed + "\"" +" " + name; + command += "\"" + locationFixed + "\"" +" \"" + name + "\""; //std::cout << "executing " << command << std::endl; if (system ( command.c_str() ) ) { @@ -119,16 +119,16 @@ bool modelCDMMain::CreateProject( return false; } - std::string nomDirectory = locationFixed + "/" + name; - std::string nomPackageDirectory = nomDirectory + "/" + "bbtk_" + name + "_PKG"; + std::string nomDirectory = locationFixed + CDMUtilities::SLASH + name; + std::string nomPackageDirectory = nomDirectory + CDMUtilities::SLASH + "bbtk_" + name + "_PKG"; std::string bbCreatePackage("bbCreatePackage "); - bbCreatePackage += nomDirectory + " " + name + " " + author + " " + description; + bbCreatePackage += "\"" + nomDirectory + "\" \"" + name + "\" \"" + author + "\" \"" + description + "\""; //std::cout << "executing " << bbCreatePackage << std::endl; system (bbCreatePackage.c_str()); std::string add; - add = "echo 'ADD_SUBDIRECTORY(bbtk_" + name + "_PKG)' >> " + nomDirectory + "/CMakeLists.txt"; + add = "echo 'ADD_SUBDIRECTORY(bbtk_" + name + "_PKG)' >> \"" + nomDirectory + CDMUtilities::SLASH + "CMakeLists.txt\""; //std::cout << "executing " << add << std::endl; system(add.c_str()); @@ -139,7 +139,7 @@ bool modelCDMMain::CreateProject( return false; } - this->project = new modelCDMProject(nomDirectory); + this->project = new modelCDMProject(nomDirectory, name); #endif @@ -161,7 +161,7 @@ bool modelCDMMain::OpenProject( std::string pathBuild = ""; //check if Makefile file exists - std::string pathMakefile = pathFixed + "/Makefile"; + std::string pathMakefile = pathFixed + CDMUtilities::SLASH + "Makefile"; FILE* pFile = fopen(pathMakefile.c_str(), "r"); //is the binary folder @@ -191,7 +191,7 @@ bool modelCDMMain::OpenProject( bool isSource = false; std::string pathSource = ""; //check if CMakeLists file exists - std::string pathCMakeLists = pathFixed + "/CMakeLists.txt"; + std::string pathCMakeLists = pathFixed + CDMUtilities::SLASH + "CMakeLists.txt"; pFile = fopen(pathCMakeLists.c_str(), "r"); //is the source folder @@ -226,16 +226,19 @@ bool modelCDMMain::OpenProject( if (!CloseProject(result)) return false; } + std::vector words; + CDMUtilities::splitter::split(words, pathSource, CDMUtilities::SLASH, CDMUtilities::splitter::no_empties); std::cout << "Project sources at: " << pathSource << std::endl; if(isBinary) { std::cout << ", and built in: " << pathBuild << std::endl; - this->project = new modelCDMProject(pathSource, pathBuild); + + this->project = new modelCDMProject(pathSource, words[words.size()-1], pathBuild); } else { - this->project = new modelCDMProject(pathSource); + this->project = new modelCDMProject(pathSource, words[words.size()-1]); } } else