/* # --------------------------------------------------------------------- # # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image # pour la Santé) # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton # Previous Authors : Laurent Guigues, Jean-Pierre Roux # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil # # This software is governed by the CeCILL-B license under French law and # abiding by the rules of distribution of free software. You can use, # modify and/ or redistribute the software under the terms of the CeCILL-B # license as circulated by CEA, CNRS and INRIA at the following URL # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html # or in the file LICENSE.txt. # # As a counterpart to the access to the source code and rights to copy, # modify and redistribute granted by the license, users are provided only # with a limited warranty and the software's author, the holder of the # economic rights, and the successive licensors have only limited # liability. # # The fact that you are presently reading this means that you have had # knowledge of the CeCILL-B license and that you accept its terms. # ------------------------------------------------------------------------ */ /* * ControlCreaDevManagerMain.cpp * * Created on: 5/11/2012 * Author: daniel */ #include "ControlCreaDevManagerMain.h" #include #include ControlCreaDevManagerMain::ControlCreaDevManagerMain() { } ControlCreaDevManagerMain::~ControlCreaDevManagerMain() { } const modelCDMProjectsTree& ControlCreaDevManagerMain::GetActiveProjects() const { return projectsTree; } bool ControlCreaDevManagerMain::LoadActiveProjects() { // TODO LoadActiveProjects std::cerr << "LoadActiveProjects unimplemented yet" << std::endl; return true; } bool ControlCreaDevManagerMain::UpdateActiveProjects() { // TODO UpdateActiveProjects std::cerr << "UpdateActiveProjects unimplemented yet" << std::endl; return true; } const int ControlCreaDevManagerMain::OpenProject(const std::string& actualpath) { std::string path = actualpath; std::cout << "selection path: "<< path << std::endl; std::string path1 = path + "/Makefile"; FILE* pFile = fopen(path1.c_str(), "r"); if(pFile == NULL) // not the binary folder { std::cerr << path1 << ": file not found..." << std::endl; path1 = path + "/CMakeLists.txt"; pFile = fopen(path1.c_str(), "r"); if(pFile == NULL) //not the source folder { std::cerr << path1 << ": file not found..." << std::endl; return 1; }else{//source folder std::cout << "sources folder found..." << std::endl; fclose(pFile); } }else{//binary folder std::cout << "binary folder found..." << std::endl; fclose(pFile); std::ifstream readFile; readFile.open(path1.c_str()); std::string word; bool found = false; while(!found && readFile >> word) { //cout << word << endl; if(word == "CMAKE_SOURCE_DIR") { readFile >> word; readFile.ignore(); getline(readFile, word, '\n'); path = word; found = true; } } readFile.close(); if(!found) { std::cerr << "sources not found..." << std::endl; return 2; }else{ pFile = fopen(path.c_str(), "r"); std::cout << "sources at " << path << " open = " << (pFile != NULL) << std::endl; std::cout.flush(); } } projectsTree.SetRoot(path); projectsTree.populateNode(path); return 0; } bool ControlCreaDevManagerMain::CloseProject(const std::string& projectName) { // TODO CloseProject std::cerr << "CloseProject unimplemented yet" << std::endl; return true; }