2 * ControlCreaDevManagerProject.cpp
4 * Created on: 5/11/2012
8 #include "ControlCreaDevManagerProject.h"
11 #include <wx/dirdlg.h>
12 #include <stdlib.h> // for getenv
14 ControlCreaDevManagerProject::ControlCreaDevManagerProject()
16 // TODO Auto-generated constructor stub
20 ControlCreaDevManagerProject::~ControlCreaDevManagerProject()
22 // TODO Auto-generated destructor stub
25 bool ControlCreaDevManagerProject::CreateProject(const std::string& name, const std::string& dir, const std::string& author, const std::string& description)
30 std::string command("creaNewProject.bat ");
31 std::string command1("creaSed.exe ");
32 std::string command2("del ");
34 command += "\"" + dir + "\" \"" + name + "\"";
35 command1 += "\"" + dir+"\\"+name+"\\CMakeLists.txt.in\" " + "NameOfTheProject " + name + "> \"" + dir + "\\" + name + "\\CMakeLists.txt\"";
36 command2 += "\"" + dir+"\\"+name+"\\CMakeLists.txt.in\"";
37 if ( ! system ( command.c_str() ) )
39 system ( command1.c_str() );
40 system ( command2.c_str() );
42 // Create a Package at the same time. JPR
43 char *author = author.c_str();
44 std::string nomDirectory = dir + "\\" + name;
45 std::string nomPackageDirectory = nomDirectory + "\\" + "bbtk_" + name + "_PKG";
46 std::string bbCreatePackage("bbCreatePackage ");
47 bbCreatePackage += nomDirectory + " " + name + " " + author + " " + description;
48 system (bbCreatePackage.c_str());
50 add = "echo ADD_SUBDIRECTORY(bbtk_" + name + "_PKG) >> " + nomDirectory + "/CMakeLists.txt";
53 wxMessageBox(_T("New Project created !"),_T("creaNewProject"), wxOK | wxICON_INFORMATION);
57 wxString err(_T("An error occured while running '"));
58 err += crea::std2wx(command) + _T("'");
59 wxMessageBox(err,_T("creaNewProject"),wxOK | wxICON_ERROR);
63 // ------ LINUX / MacOS
66 std::string command("creaNewProject.sh ");
67 command += "\"" + dir + "\"" +" " + name;
68 std::cout << "executing " << command << std::endl;
69 if ( ! system ( command.c_str() ) )
71 //wxMessageBox(_T("New Project created !"),_T("creaNewProject"), wxOK | wxICON_INFORMATION);
73 std::string nomDirectory = dir + "/" + name;
74 std::string nomPackageDirectory = nomDirectory + "/" + "bbtk_" + name + "_PKG";
76 std::string bbCreatePackage("bbCreatePackage ");
77 bbCreatePackage += nomDirectory + " " + name + " " + author + " " + description;
78 std::cout << "executing " << bbCreatePackage << std::endl;
79 system (bbCreatePackage.c_str());
82 add = "echo 'ADD_SUBDIRECTORY(bbtk_" + name + "_PKG)' >> " + nomDirectory + "/CMakeLists.txt";
83 //std::cout << add << std::endl;
84 std::cout << "executing " << add << std::endl;
90 wxString err(_T("An error occured while running '"));
91 err += crea::std2wx(command) + _T("'");
92 wxMessageBox(err,_T("creaNewProject"),wxOK | wxICON_ERROR);