2 # ---------------------------------------------------------------------
4 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
6 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
7 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
8 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
10 # This software is governed by the CeCILL-B license under French law and
11 # abiding by the rules of distribution of free software. You can use,
12 # modify and/ or redistribute the software under the terms of the CeCILL-B
13 # license as circulated by CEA, CNRS and INRIA at the following URL
14 # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
15 # or in the file LICENSE.txt.
17 # As a counterpart to the access to the source code and rights to copy,
18 # modify and redistribute granted by the license, users are provided only
19 # with a limited warranty and the software's author, the holder of the
20 # economic rights, and the successive licensors have only limited
23 # The fact that you are presently reading this means that you have had
24 # knowledge of the CeCILL-B license and that you accept its terms.
25 # ------------------------------------------------------------------------
31 * Created on: 13/11/2012
32 * Author: Daniel Felipe Gonzalez Obando
35 #include "modelCDMMain.h"
42 #include "CDMUtilities.h"
44 modelCDMMain::modelCDMMain()
46 //TODO: implement method
49 modelCDMMain::~modelCDMMain()
51 //TODO: implement method
54 const modelCDMProject* modelCDMMain::GetProject() const
56 //TODO: implement method
60 bool modelCDMMain::CreateProject(
61 const std::string& name,
62 const std::string& location,
64 const std::string& author,
65 const std::string& description)
67 //TODO: implement method
71 bool modelCDMMain::OpenProject(
72 const std::string& path,
76 std::cout << "Selection path: "<< path << std::endl;
79 std::string pathFixed = CDMUtilities::fixPath(path);
80 std::cout << "Fixed selection path: "<< pathFixed << std::endl;
82 //check if its binaries' folder
83 bool isBinary = false;
84 std::string pathBuild = "";
86 //check if Makefile file exists
87 std::string pathMakefile = pathFixed + "/Makefile";
88 FILE* pFile = fopen(pathMakefile.c_str(), "r");
90 //is the binary folder
94 std::ifstream readFile;
95 readFile.open(pathMakefile.c_str());
98 while(!isBinary && readFile >> word)
100 //cout << word << endl;
101 if(word == "CMAKE_SOURCE_DIR")
105 getline(readFile, word, '\n');
106 pathBuild = pathFixed;
114 //check if its source's folder
115 bool isSource = false;
116 std::string pathSource = "";
117 //check if CMakeLists file exists
118 std::string pathCMakeLists = pathFixed + "/CMakeLists.txt";
119 pFile = fopen(pathCMakeLists.c_str(), "r");
121 //is the source folder
125 std::ifstream readFile;
126 readFile.open(pathCMakeLists.c_str());
130 while(!isSource && !readFile.eof())
132 std::getline(readFile,word,'\n');
133 int pos = word.find("PROJECT");
134 if(pos != std::string::npos)
136 pathSource = pathFixed;
143 //if is source folder
146 std::cout << "Project sources at: " << pathSource;
149 std::cout << ", and built in: " << pathBuild;
151 std::cout << std::endl;
155 result = new std::string("No source folder found. Please make sure to select either the project's build or source folder.");
159 //TODO: create Project given the source folder
163 bool modelCDMMain::RefreshProject(
167 //TODO: recreate the project using the project's path
171 bool modelCDMMain::CloseProject(
175 //TODO: delete the project tree and leave it as NULL