2 * ControlCreaDevManagerMain.cpp
4 * Created on: 5/11/2012
8 #include "ControlCreaDevManagerMain.h"
9 #include "ModelCreaDevManagerTree.h"
14 ControlCreaDevManagerMain::ControlCreaDevManagerMain()
18 ControlCreaDevManagerMain::~ControlCreaDevManagerMain()
22 const ModelCreaDevManagerTree& ControlCreaDevManagerMain::GetActiveProjects() const
27 bool ControlCreaDevManagerMain::LoadActiveProjects()
29 // TODO LoadActiveProjects
30 std::cerr << "LoadActiveProjects unimplemented yet" << std::endl;
34 bool ControlCreaDevManagerMain::UpdateActiveProjects()
36 // TODO UpdateActiveProjects
37 std::cerr << "UpdateActiveProjects unimplemented yet" << std::endl;
41 const int ControlCreaDevManagerMain::OpenProject(const std::string& actualpath)
43 std::string path = actualpath;
44 std::cout << "selection path: "<< path << std::endl;
45 std::string path1 = path + "/Makefile";
46 FILE* pFile = fopen(path1.c_str(), "r");
47 if(pFile == NULL) // not the binary folder
49 std::cerr << path1 << ": file not found..." << std::endl;
50 path1 = path + "/CMakeLists.txt";
51 pFile = fopen(path1.c_str(), "r");
52 if(pFile == NULL) //not the source folder
54 std::cerr << path1 << ": file not found..." << std::endl;
57 std::cout << "sources folder found..." << std::endl;
61 std::cout << "binary folder found..." << std::endl;
64 std::ifstream readFile;
65 readFile.open(path1.c_str());
69 while(!found && readFile >> word)
71 //cout << word << endl;
72 if(word == "CMAKE_SOURCE_DIR")
76 getline(readFile, word, '\n');
85 std::cerr << "sources not found..." << std::endl;
89 pFile = fopen(path.c_str(), "r");
90 std::cout << "sources at " << path << " open = " << (pFile != NULL) << std::endl;
95 projectsTree.addRoot(path);
96 projectsTree.populateNode(path);
100 bool ControlCreaDevManagerMain::CloseProject(const std::string& projectName)
103 std::cerr << "CloseProject unimplemented yet" << std::endl;