From 327c33758d25e6ff1f90f9ab74ea219eaed934a9 Mon Sep 17 00:00:00 2001 From: Daniel Felipe Gonzalez Date: Thu, 31 Jan 2013 14:55:11 +0100 Subject: [PATCH] Feature #1711 CreaDevManager application implementation - Changes for windows compatibility. Model ready and build ready. Some minor presentation bugs still present for windows --- lib/creaDevManagerLib/CDMUtilities.cpp | 28 ++++++++- lib/creaDevManagerLib/CDMUtilities.h | 6 ++ lib/creaDevManagerLib/modelCDMAppli.cpp | 24 +++++++- lib/creaDevManagerLib/modelCDMApplication.cpp | 5 ++ lib/creaDevManagerLib/modelCDMBlackBox.cpp | 14 +++++ lib/creaDevManagerLib/modelCDMLib.cpp | 22 ++++++- lib/creaDevManagerLib/modelCDMLibrary.cpp | 4 ++ lib/creaDevManagerLib/modelCDMMain.cpp | 34 +++++++++-- lib/creaDevManagerLib/modelCDMPackage.cpp | 15 +++++ lib/creaDevManagerLib/modelCDMPackageSrc.cpp | 7 +++ lib/creaDevManagerLib/modelCDMProject.cpp | 57 +++++++++++++++++-- lib/creaDevManagerLib/modelCDMProject.h | 2 +- .../wxCDMApplicationDescriptionPanel.cpp | 2 +- .../wxCDMProjectActionsPanel.cpp | 23 +++++++- 14 files changed, 223 insertions(+), 20 deletions(-) diff --git a/lib/creaDevManagerLib/CDMUtilities.cpp b/lib/creaDevManagerLib/CDMUtilities.cpp index 29ed9c0..09e25f3 100644 --- a/lib/creaDevManagerLib/CDMUtilities.cpp +++ b/lib/creaDevManagerLib/CDMUtilities.cpp @@ -112,7 +112,8 @@ namespace CDMUtilities std::string command = TEXT_EDITOR; if(file != "") - command += " \"" + file + "\" &"; + command += " \"" + file + "\""; + command += " &"; return system(command.c_str()); } @@ -122,7 +123,8 @@ namespace CDMUtilities std::string command = FILE_EXPLORER; if(file != "") - command += " \"" + file + "\" &"; + command += " \"" + file + "\""; + command += " &"; return system(command.c_str()); } @@ -131,7 +133,8 @@ namespace CDMUtilities { std::string comm = command; if(file != "") - comm += " \"" + file + "\" &"; + comm += " \"" + file + "\""; + comm += " &"; return system(comm.c_str()); } @@ -144,7 +147,12 @@ namespace CDMUtilities int openCreaToolsTools() { +#ifdef _WIN32 + std::string comm = "creaTools &"; +#else std::string comm = "creaTools.sh &"; +#endif + return system(comm.c_str()); } @@ -305,4 +313,18 @@ namespace CDMUtilities return true; } + std::string stringify(const std::string& line) + { + std::string res; + for (int i = 0; i < line.size(); i++) + { + if(line[i] == '\\') + res.push_back('\\'); + if(line[i] == '\"') + res.push_back('\\'); + res.push_back(line[i]); + } + return res; + } + } diff --git a/lib/creaDevManagerLib/CDMUtilities.h b/lib/creaDevManagerLib/CDMUtilities.h index 4236eb5..02c3b82 100644 --- a/lib/creaDevManagerLib/CDMUtilities.h +++ b/lib/creaDevManagerLib/CDMUtilities.h @@ -170,6 +170,12 @@ namespace CDMUtilities * @return True if the class was successfully created. */ bool createEmptyClass(const std::string& name, const std::string& path); + /** + * Creates a string replacing each \ by \\. + * @param line String to stringify. + * @return line stringified. + */ + std::string stringify(const std::string& line); }; #endif /* CDMUTILITIES_H_ */ diff --git a/lib/creaDevManagerLib/modelCDMAppli.cpp b/lib/creaDevManagerLib/modelCDMAppli.cpp index 4f61e13..be0852a 100644 --- a/lib/creaDevManagerLib/modelCDMAppli.cpp +++ b/lib/creaDevManagerLib/modelCDMAppli.cpp @@ -121,12 +121,29 @@ const std::vector& modelCDMAppli::GetApplications() const } modelCDMApplication* modelCDMAppli::CreateApplication( - const std::string& name, + const std::string& namein, std::string*& result ) { + std::vector words; + CDMUtilities::splitter::split(words,namein," '/\\*\"%",CDMUtilities::splitter::no_empties); + std::string name; + for (int i = 0; i < (int)(words.size()); i++) + { + name += words[i]; + } + if (name == "") + { + result = new std::string("The given name is not valid: '/\\*\"% are forbidden."); + return NULL; + } //copy template application folder with new name +#ifdef _WIN32 + std::string copyCommand = "xcopy \"" + this->path + CDMUtilities::SLASH + "template_appli\" \"" + this->path + CDMUtilities::SLASH + name + CDMUtilities::SLASH + "\" /Y"; +#else std::string copyCommand = "cp -r \"" + this->path + CDMUtilities::SLASH + "template_appli\" \"" + this->path + CDMUtilities::SLASH + name + "\""; +#endif + if(system(copyCommand.c_str())) { result = new std::string("An error occurred while running '" + copyCommand + "'."); @@ -150,7 +167,12 @@ modelCDMApplication* modelCDMAppli::CreateApplication( in.close(); out.close(); //delete old file and rename new file +#ifdef _WIN32 + std::string renameCommand = "move /Y \"" + this->path + CDMUtilities::SLASH + name + CDMUtilities::SLASH + "CMakeLists.txt.tmp\" \"" + this->path + CDMUtilities::SLASH + name + CDMUtilities::SLASH + "CMakeLists.txt\""; +#else std::string renameCommand = "mv \"" + this->path + CDMUtilities::SLASH + name + CDMUtilities::SLASH + "CMakeLists.txt.tmp\" \"" + this->path + CDMUtilities::SLASH + name + CDMUtilities::SLASH + "CMakeLists.txt\""; +#endif + if(system(renameCommand.c_str())) { result = new std::string("An error occurred while running '" + renameCommand + "'."); diff --git a/lib/creaDevManagerLib/modelCDMApplication.cpp b/lib/creaDevManagerLib/modelCDMApplication.cpp index 40fb810..c77f3be 100644 --- a/lib/creaDevManagerLib/modelCDMApplication.cpp +++ b/lib/creaDevManagerLib/modelCDMApplication.cpp @@ -206,7 +206,12 @@ bool modelCDMApplication::SetExecutableName(const std::string& fileName, std::st in.close(); out.close(); //delete old file and rename new file +#ifdef _WIN32 + std::string renameCommand = "move /Y \"" + this->path + CDMUtilities::SLASH + "CMakeLists.txt.tmp\" \"" + this->path + CDMUtilities::SLASH + "CMakeLists.txt\""; +#else std::string renameCommand = "mv \"" + this->path + CDMUtilities::SLASH + "CMakeLists.txt.tmp\" \"" + this->path + CDMUtilities::SLASH + "CMakeLists.txt\""; +#endif + if(system(renameCommand.c_str())) { result = new std::string("An error occurred while running '" + renameCommand + "'."); diff --git a/lib/creaDevManagerLib/modelCDMBlackBox.cpp b/lib/creaDevManagerLib/modelCDMBlackBox.cpp index 295a433..73220cc 100644 --- a/lib/creaDevManagerLib/modelCDMBlackBox.cpp +++ b/lib/creaDevManagerLib/modelCDMBlackBox.cpp @@ -172,7 +172,12 @@ bool modelCDMBlackBox::SetAuthors(const std::string& authors, std::string*& resu in.close(); out.close(); //delete old file and rename new file +#ifdef _WIN32 + std::string renameCommand = "move /Y \"" + pathHeader + ".tmp\" \"" + pathHeader + "\""; +#else std::string renameCommand = "mv \"" + pathHeader + ".tmp\" \"" + pathHeader + "\""; +#endif + if(system(renameCommand.c_str())) { result = new std::string("An error occurred while running '" + renameCommand + "'."); @@ -232,7 +237,12 @@ bool modelCDMBlackBox::SetCategories( in.close(); out.close(); //delete old file and rename new file +#ifdef _WIN32 + std::string renameCommand = "move /Y \"" + pathHeader + ".tmp\" \"" + pathHeader + "\""; +#else std::string renameCommand = "mv \"" + pathHeader + ".tmp\" \"" + pathHeader + "\""; +#endif + if(system(renameCommand.c_str())) { result = new std::string("An error occurred while running '" + renameCommand + "'."); @@ -291,7 +301,11 @@ bool modelCDMBlackBox::SetDescription( in.close(); out.close(); //delete old file and rename new file +#ifdef _WIN32 + std::string renameCommand = "move /Y \"" + pathHeader + ".tmp\" \"" + pathHeader + "\""; +#else std::string renameCommand = "mv \"" + pathHeader + ".tmp\" \"" + pathHeader + "\""; +#endif if(system(renameCommand.c_str())) { result = new std::string("An error occurred while running '" + renameCommand + "'."); diff --git a/lib/creaDevManagerLib/modelCDMLib.cpp b/lib/creaDevManagerLib/modelCDMLib.cpp index 57411ec..e3c2902 100644 --- a/lib/creaDevManagerLib/modelCDMLib.cpp +++ b/lib/creaDevManagerLib/modelCDMLib.cpp @@ -121,12 +121,28 @@ const std::vector& modelCDMLib::GetLibraries() const } modelCDMLibrary* modelCDMLib::CreateLibrary( - const std::string& name, + const std::string& namein, std::string*& result ) { + std::vector words; + CDMUtilities::splitter::split(words,namein," '/\\*\"%",CDMUtilities::splitter::no_empties); + std::string name; + for (int i = 0; i < (int)(words.size()); i++) + { + name += words[i]; + } + if (name == "") + { + result = new std::string("The given name is not valid: '/\\*\"% are forbidden."); + return NULL; + } //copy template library folder with new name +#ifdef _WIN32 + std::string copyCommand = "xcopy \"" + this->path + CDMUtilities::SLASH + "template_lib\" \"" + this->path + CDMUtilities::SLASH + name + CDMUtilities::SLASH + "\" /Y"; +#else std::string copyCommand = "cp -r \"" + this->path + CDMUtilities::SLASH + "template_lib\" \"" + this->path + CDMUtilities::SLASH + name + "\""; +#endif if(system(copyCommand.c_str())) { result = new std::string("An error occurred while running '" + copyCommand + "'."); @@ -150,7 +166,11 @@ modelCDMLibrary* modelCDMLib::CreateLibrary( in.close(); out.close(); //delete old file and rename new file +#ifdef _WIN32 + std::string renameCommand = "move /Y \"" + this->path + CDMUtilities::SLASH + name + CDMUtilities::SLASH + "CMakeLists.txt.tmp\" \"" + this->path + CDMUtilities::SLASH + name + CDMUtilities::SLASH + "CMakeLists.txt\""; +#else std::string renameCommand = "mv \"" + this->path + CDMUtilities::SLASH + name + CDMUtilities::SLASH + "CMakeLists.txt.tmp\" \"" + this->path + CDMUtilities::SLASH + name + CDMUtilities::SLASH + "CMakeLists.txt\""; +#endif if(system(renameCommand.c_str())) { result = new std::string("An error occurred while running '" + renameCommand + "'."); diff --git a/lib/creaDevManagerLib/modelCDMLibrary.cpp b/lib/creaDevManagerLib/modelCDMLibrary.cpp index 58cc892..7b99318 100644 --- a/lib/creaDevManagerLib/modelCDMLibrary.cpp +++ b/lib/creaDevManagerLib/modelCDMLibrary.cpp @@ -181,7 +181,11 @@ bool modelCDMLibrary::SetNameLibrary(const std::string& fileName, std::string*& in.close(); out.close(); //delete old file and rename new file +#ifdef _WIN32 + std::string renameCommand = "move /Y \"" + this->path + CDMUtilities::SLASH + "CMakeLists.txt.tmp\" \"" + this->path + CDMUtilities::SLASH + "CMakeLists.txt\""; +#else std::string renameCommand = "mv \"" + this->path + CDMUtilities::SLASH + "CMakeLists.txt.tmp\" \"" + this->path + CDMUtilities::SLASH + "CMakeLists.txt\""; +#endif if(system(renameCommand.c_str())) { result = new std::string("An error occurred while running '" + renameCommand + "'."); diff --git a/lib/creaDevManagerLib/modelCDMMain.cpp b/lib/creaDevManagerLib/modelCDMMain.cpp index 71f60f6..8d69741 100644 --- a/lib/creaDevManagerLib/modelCDMMain.cpp +++ b/lib/creaDevManagerLib/modelCDMMain.cpp @@ -38,6 +38,7 @@ #include #include #include +#include #include #include @@ -175,11 +176,13 @@ bool modelCDMMain::OpenProject( std::string pathBuild = ""; //check if Makefile file exists - std::string pathMakefile = pathFixed + CDMUtilities::SLASH + "Makefile"; - FILE* pFile; #ifdef _WIN32 + std::string pathMakefile = pathFixed + CDMUtilities::SLASH + "CMakeCache.txt"; + FILE* pFile; errno_t errorOpen = fopen_s(&pFile, pathMakefile.c_str(), "r"); #else + std::string pathMakefile = pathFixed + CDMUtilities::SLASH + "Makefile"; + FILE* pFile; pFile = fopen(pathMakefile.c_str(), "r"); bool errorOpen = (pFile == NULL); #endif @@ -191,9 +194,29 @@ bool modelCDMMain::OpenProject( readFile.open(pathMakefile.c_str()); std::string word; + +#ifdef _WIN32 + while(!isBinary && !readFile.eof()) + { + getline(readFile, word, '\n'); + std::vector words; + CDMUtilities::splitter::split(words,word,"=",CDMUtilities::splitter::no_empties); + if(words.size() && words[0] == "CMAKE_HOME_DIRECTORY:INTERNAL") + { + pathBuild = pathFixed; + pathFixed = CDMUtilities::fixPath(words[1]); + for (int i = 0; i < (int)(pathFixed.size()); i++) + { + if (pathFixed[i]=='/') + pathFixed[i]='\\'; + } + isBinary = true; + } + } +#else while(!isBinary && readFile >> word) { - if(word == "CMAKE_SOURCE_DIR") + if(word == "CMAKE_SOURCE_DIR") { readFile >> word; readFile.ignore(); @@ -202,7 +225,8 @@ bool modelCDMMain::OpenProject( pathFixed = CDMUtilities::fixPath(word); isBinary = true; } - } + } +#endif readFile.close(); } @@ -267,7 +291,7 @@ bool modelCDMMain::OpenProject( } else { - result = new std::string("No source folder found. Please make sure to select either the project's build or source folder."); + result = new std::string("No source folder found. Please make sure to select either the project's build or source folder. " + pathBuild + pathFixed); return false; } diff --git a/lib/creaDevManagerLib/modelCDMPackage.cpp b/lib/creaDevManagerLib/modelCDMPackage.cpp index 78b6adf..66c5e22 100644 --- a/lib/creaDevManagerLib/modelCDMPackage.cpp +++ b/lib/creaDevManagerLib/modelCDMPackage.cpp @@ -244,7 +244,12 @@ bool modelCDMPackage::SetAuthors(const std::string& authors, std::string*& resul in.close(); out.close(); //delete old file and rename new file +#ifdef _WIN32 + std::string renameCommand = "move /Y \"" + this->path + CDMUtilities::SLASH + "CMakeLists.txt.tmp\" \"" + this->path + CDMUtilities::SLASH + "CMakeLists.txt\""; +#else std::string renameCommand = "mv \"" + this->path + CDMUtilities::SLASH + "CMakeLists.txt.tmp\" \"" + this->path + CDMUtilities::SLASH + "CMakeLists.txt\""; +#endif + if(system(renameCommand.c_str())) { result = new std::string("An error occurred while running '" + renameCommand + "'."); @@ -296,7 +301,12 @@ bool modelCDMPackage::SetVersion(const std::string& version, std::string*& resul in.close(); out.close(); //delete old file and rename new file +#ifdef _WIN32 + std::string renameCommand = "move /Y \"" + this->path + CDMUtilities::SLASH + "CMakeLists.txt.tmp\" \"" + this->path + CDMUtilities::SLASH + "CMakeLists.txt\""; +#else std::string renameCommand = "mv \"" + this->path + CDMUtilities::SLASH + "CMakeLists.txt.tmp\" \"" + this->path + CDMUtilities::SLASH + "CMakeLists.txt\""; +#endif + if(system(renameCommand.c_str())) { result = new std::string("An error occurred while running '" + renameCommand + "'."); @@ -342,7 +352,12 @@ bool modelCDMPackage::SetDescription(const std::string& description, std::string in.close(); out.close(); //delete old file and rename new file +#ifdef _WIN32 + std::string renameCommand = "move /Y \"" + this->path + CDMUtilities::SLASH + "CMakeLists.txt.tmp\" \"" + this->path + CDMUtilities::SLASH + "CMakeLists.txt\""; +#else std::string renameCommand = "mv \"" + this->path + CDMUtilities::SLASH + "CMakeLists.txt.tmp\" \"" + this->path + CDMUtilities::SLASH + "CMakeLists.txt\""; +#endif + if(system(renameCommand.c_str())) { result = new std::string("An error occurred while running '" + renameCommand + "'."); diff --git a/lib/creaDevManagerLib/modelCDMPackageSrc.cpp b/lib/creaDevManagerLib/modelCDMPackageSrc.cpp index 17c37a2..5c10bba 100644 --- a/lib/creaDevManagerLib/modelCDMPackageSrc.cpp +++ b/lib/creaDevManagerLib/modelCDMPackageSrc.cpp @@ -209,10 +209,17 @@ modelCDMBlackBox* modelCDMPackageSrc::CreateBlackBox( //create command std::string command = "bbCreateBlackBox"; command += " \"" + this->path + "\""; +#ifdef _WIN32 + command += " " + package; + command += " " + bbName; + command += " " + type; + command += " " + format; +#else command += " \"" + package + "\""; command += " \"" + bbName + "\""; command += " \"" + type + "\""; command += " \"" + format + "\""; +#endif command += " \"" + bbAuthors + "\""; command += " \"" + bbDescription + "\""; command += " \"" + bbCategories + "\""; diff --git a/lib/creaDevManagerLib/modelCDMProject.cpp b/lib/creaDevManagerLib/modelCDMProject.cpp index 2996910..8b93e18 100644 --- a/lib/creaDevManagerLib/modelCDMProject.cpp +++ b/lib/creaDevManagerLib/modelCDMProject.cpp @@ -301,7 +301,11 @@ bool modelCDMProject::SetVersion(const std::string& version, std::string*& resul in.close(); out.close(); //delete old file and rename new file +#ifdef _WIN32 + std::string renameCommand = "move /Y \"" + this->path + CDMUtilities::SLASH + "CMakeLists.txt.tmp\" \"" + this->path + CDMUtilities::SLASH + "CMakeLists.txt\""; +#else std::string renameCommand = "mv \"" + this->path + CDMUtilities::SLASH + "CMakeLists.txt.tmp\" \"" + this->path + CDMUtilities::SLASH + "CMakeLists.txt\""; +#endif if(system(renameCommand.c_str())) { result = new std::string("An error occurred while running '" + renameCommand + "'."); @@ -373,7 +377,11 @@ modelCDMIProjectTreeNode* modelCDMProject::CreatePackage( //call project to create package : use bbCreatePackage [author] [description] std::string creationCommand = "bbCreatePackage \"" + this->path + "\" \"" + nameFixed + "\" \"" + authorFixed + "\" \"" + descriptionFixed + "\""; //TODO: bbCreatePackage script always returning 0. It should return 1 or greater if any error - if(system(creationCommand.c_str())) + bool resultCommand = 0 != system(creationCommand.c_str()); +#ifdef _WIN32 + resultCommand = false; +#endif + if(resultCommand) { result = new std::string("An error occurred while running '" + creationCommand + "'."); return NULL; @@ -684,6 +692,13 @@ bool modelCDMProject::ConfigureBuild(std::string*& result) //TODO: adjust for windows and mac #ifdef _WIN32 // ------ Windows + if(0 == system("cmake-gui")) + return true; + else + { + result = new std::string("There was an error opening cmake-gui. Please make sure it's installed and that cmake's bin folder is in the system path."); + return false; + } #elif __APPLE__ // ------ Apple #else @@ -723,6 +738,17 @@ bool modelCDMProject::Build(std::string*& result, const std::string& line) //TODO: adjust for windows and mac #ifdef _WIN32 // ------ Windows + //\\..\\IDE\\VCExpress.exe \"" + this->buildPath + CDMUtilities::SLASH + this->nameProject + ".sln\" +// std::string command = "\"" + std::string(getenv("VS90COMNTOOLS")) + "..\\IDE\\VCExpress.exe\" \"" + this->buildPath + CDMUtilities::SLASH + this->nameProject + ".sln\" &"; + std::string command = "\"\"%VS90COMNTOOLS%..\\IDE\\VCExpress.exe\" \"" + this->buildPath + CDMUtilities::SLASH + this->nameProject + ".sln\" &\""; + command = "start cmd.exe /k " + command + " &"; + if(0 == system(command.c_str())) + return true; + else + { + result = new std::string("An error has happened running: \"" + command + "\". Please make sure to have visual c++ express installed and to have the VS90COMNTOOLS environment variable set."); + return false; + } #elif __APPLE__ // ------ Apple #else @@ -768,22 +794,41 @@ bool modelCDMProject::Build(std::string*& result, const std::string& line) return true; } -bool modelCDMProject::Connect(std::string*& result) +bool modelCDMProject::Connect(std::string*& result, const std::string& folder) { - //TODO: adjust for windows and mac + //TODO: adjust for mac #ifdef _WIN32 // ------ Windows + //open binary folder + wxDir dir(crea::std2wx(folder)); + + //if binary folder can't be opened then return false + if (!dir.IsOpened()) + { + result = new std::string("The path could not be opened. Make sure the folder exists and contains a bbtkPackage file."); + return false; + } + //create plug command + std::string plugComm = "bbPlugPackage \"" + folder + "\""; + std::cout << "executing '" << plugComm << "'" << std::endl; + //execute plug command + if(system(std::string("start cmd.exe /k \"" + plugComm + "\"").c_str())) + { + //if there was an error then report it + result = new std::string("There was an error plugging the packages of the project, please check the console to read more about the problem."); + return false; + } #elif __APPLE__ // ------ Apple #else // ------ Linux //open binary folder - wxDir dir(crea::std2wx((this->buildPath).c_str())); + wxDir dir(crea::std2wx(folder)); //if binary folder can't be opened then return false if (!dir.IsOpened()) { - result = new std::string("The build path could not be opened. Make sure to configure the project before compiling it"); + result = new std::string("The path could not be opened. Make sure the folder exists and contains a bbtkPackage file."); return false; } //create plug command @@ -793,7 +838,7 @@ bool modelCDMProject::Connect(std::string*& result) if(system(plugComm.c_str())) { //if there was an error then report it - result = new std::string("There was an error plugging the packages of the project, please check the console to read more about the problem."); + result = new std::string("There was an error plugging the packages of the project, please check the plugging.log in the build folder file to read more about the problem."); return false; } #endif diff --git a/lib/creaDevManagerLib/modelCDMProject.h b/lib/creaDevManagerLib/modelCDMProject.h index 942bc9c..60a5ad5 100644 --- a/lib/creaDevManagerLib/modelCDMProject.h +++ b/lib/creaDevManagerLib/modelCDMProject.h @@ -241,7 +241,7 @@ public: * @param result Result message for connecting the project. * @return if the command cannot be executed it return false. */ - bool Connect(std::string*& result); + bool Connect(std::string*& result, const std::string& folder); /** * Checks the CMakeLists files to see what's going to be compiled and what's not. diff --git a/lib/creaDevManagerLib/wxCDMApplicationDescriptionPanel.cpp b/lib/creaDevManagerLib/wxCDMApplicationDescriptionPanel.cpp index 682236c..7cfbf06 100644 --- a/lib/creaDevManagerLib/wxCDMApplicationDescriptionPanel.cpp +++ b/lib/creaDevManagerLib/wxCDMApplicationDescriptionPanel.cpp @@ -160,7 +160,7 @@ void wxCDMApplicationDescriptionPanel::CreateControls() createClassbt->SetToolTip(wxT("Create a new Class (.h and .cxx files).")); wxButton* createFolderbt = new wxButton(actionsPanel, ID_BUTTON_CREATE_FOLDER, _T("Create Folder (Optional)")); createFolderbt->SetToolTip(wxT("Create a new Folder inside the application folder.")); - wxButton* openMainbt = new wxButton(actionsPanel, ID_BUTTON_OPEN_CXX, _T("A. Open Main File (Optional)")); + wxButton* openMainbt = new wxButton(actionsPanel, ID_BUTTON_OPEN_CXX, _T("A. Open Main File")); openMainbt->SetToolTip(wxT("Open the main file in the application folder with the default code editor.")); openMainbt->Connect(wxEVT_ENTER_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMApplicationDescriptionPanel::OnMainMouseEnter,NULL,this); openMainbt->Connect(wxEVT_LEAVE_WINDOW, (wxObjectEventFunction)(wxEventFunction)(wxMouseEventFunction)&wxCDMApplicationDescriptionPanel::OnMainMouseExit,NULL,this); diff --git a/lib/creaDevManagerLib/wxCDMProjectActionsPanel.cpp b/lib/creaDevManagerLib/wxCDMProjectActionsPanel.cpp index 3032659..ddfe262 100755 --- a/lib/creaDevManagerLib/wxCDMProjectActionsPanel.cpp +++ b/lib/creaDevManagerLib/wxCDMProjectActionsPanel.cpp @@ -124,6 +124,14 @@ void wxCDMProjectActionsPanel::OnBtnConfigureBuild(wxCommandEvent& event) //compile project void wxCDMProjectActionsPanel::OnBtnBuildProject(wxCommandEvent& event) { +#ifdef _WIN32 + std::string* result; + if(!this->project->Build(result, "")) + { + wxMessageBox(crea::std2wx(result->c_str()), wxT("Project Compilation - Error!")); + return; + } +#else //get author from user wxTextEntryDialog* buildDlg = new wxTextEntryDialog( this, @@ -152,15 +160,26 @@ void wxCDMProjectActionsPanel::OnBtnBuildProject(wxCommandEvent& event) //wxMessageBox(crea::std2wx("The compilation was executed successfully. Please check the \"building.log\" file located in the build folder to check the compilation result."), wxT("Project Compilation")); } } +#endif } //plug packages void wxCDMProjectActionsPanel::OnBtnConnectProject(wxCommandEvent& event) { std::string* result; - if(!this->project->Connect(result)) + wxString file = wxDirSelector( + wxT("Please select the folder containing the bbtkPackage file you want to use. Usually it is where you built your project."), + crea::std2wx(this->project->GetBuildPath()) + ); + + if(file.IsEmpty() || !this->project->Connect(result, crea::wx2std(file))) { wxMessageBox(crea::std2wx(result->c_str()), wxT("Plug Packages - Error!")); return; } - wxMessageBox(crea::std2wx("The connection was executed successfully. Please check the \"plugging.log\" file located in the build folder to check the compilation result."), wxT("Plug Package")); +#ifdef _WIN32 + wxMessageBox(crea::std2wx("The connection was executed successfully. Please check the console to see the compilation result."), wxT("Plug Package")); +#else + wxMessageBox(crea::std2wx("The connection was executed successfully. Please check the \"plugging.log\" file located in the build folder to see the compilation result."), wxT("Plug Package")); +#endif + } -- 2.45.0