X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;ds=sidebyside;f=kernel%2Fsrc%2FbbtkConfigurationFile.cxx;h=e3982866e38f4f0ff592f6ef5b17f050cacb1803;hb=c07f97d87b9387613baeafbf47966c29aa42705f;hp=167579f37f4636a17b3cf96dcf21309821993424;hpb=51be19a0b4d980ef0bdcbbfc5c8255d811de1883;p=bbtk.git diff --git a/kernel/src/bbtkConfigurationFile.cxx b/kernel/src/bbtkConfigurationFile.cxx index 167579f..e398286 100644 --- a/kernel/src/bbtkConfigurationFile.cxx +++ b/kernel/src/bbtkConfigurationFile.cxx @@ -3,8 +3,8 @@ Program: bbtk Module: $RCSfile: bbtkConfigurationFile.cxx,v $ Language: C++ - Date: $Date: 2008/02/06 10:53:02 $ - Version: $Revision: 1.2 $ + Date: $Date: 2008/02/13 14:08:25 $ + Version: $Revision: 1.3 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See doc/license.txt or @@ -42,16 +42,43 @@ ConfigurationFile::ConfigurationFile() std::string slash("/"); #endif -// ==> First we look for bbtk_config.xml in "." - + // ==> Set system paths + mBin_path = execPath; + mInstall_path = mBin_path + slash + ".."; + // The relative path to the doc folder (=BBTK_DOC_REL_PATH) + mDoc_rel_path = BBTK_STRINGIFY_SYMBOL(BBTK_DOC_REL_PATH); + // The path to the doc folder (=mInstall_path+"/"+mDoc_rel_path) + mDoc_path = mInstall_path + slash + mDoc_rel_path; + // The relative path to the doc folder (=BBTK_BBS_REL_PATH) + mBbs_rel_path = BBTK_STRINGIFY_SYMBOL(BBTK_BBS_REL_PATH); + // The path to the bbs folder (=mInstall_path+"/"+mBbs_rel_path) + mBbs_path = mInstall_path + slash + mBbs_rel_path; + // The relative path to the rsc folder (=BBTK_RSC_REL_PATH) + // mRsc_rel_path = BBTK_STRINGIFY_SYMBOL(BBTK_RSC_REL_PATH); + // The path to the rsc folder (=mInstall_path+"/"+mRsc_rel_path) + // mRsc_path = mInstall_path + slash + mRsc_rel_path; + // The path to the bbtk data folder + // Initialized to mInstall_path+"/"+BBTK_DATA_REL_PATH + // But can be overriden by value read from bbtk_config.xml + mData_path = mInstall_path + slash + BBTK_STRINGIFY_SYMBOL(BBTK_DATA_REL_PATH); + // MessageManager::SetMessageLevel("Config",1); + bbtkMessage("Config",1," ==> bin : '"< prefix : '"< doc : '"< bbs : '"< rsc : '"< data : '"< First we look for bbtk_config.xml in "." char buf[2048]; const char *currentDir = getcwd(buf, 2048); if( !currentDir ) { std::cerr << "Path was too long to fit on 2048 bytes ?!?" << std::endl; - /// \todo : what else? + // \todo : what else? // How abort a constructor and warn the caller function? + // LG : throw an exception } std::string configXmlFullPathName = currentDir + slash + "bbtk_config.xml"; @@ -123,15 +150,15 @@ void ConfigurationFile::CreateConfigXML( char *rootDirectory ) bbtkMessage("Config",1, "in CreateConfigXML[" << configXml << "]" << std::endl); fp = fopen (configXml, "w"); fprintf(fp, "\n"); - fprintf(fp, "\n"); + // fprintf(fp, "\n"); fprintf(fp, "\n"); fprintf(fp, " \n"); - fprintf(fp, " http://www.creatis.insa-lyon.fr/software/bbtk \n"); - fprintf(fp, " \n"); + // fprintf(fp, " http://www.creatis.insa-lyon.fr/software/bbtk \n"); + // fprintf(fp, " \n"); fprintf(fp, " \n"); // fprintf(fp, " \n"); fprintf(fp, " \n"); - fprintf(fp, " %s \n", BBTK_DATA_PATH); + fprintf(fp, " \n");//, BBTK_DATA_PATH); /// \todo find a decent default value ! ///fprintf(fp, " %s \n", " "); // when $ will be found, default_temp_dir value will be replaced @@ -376,13 +403,15 @@ void ConfigurationFile::Read(const std::string& filename) GetTextOrClear(BB.getChildNode((XMLCSTR)"data_path"),mData_path); // install_path - if( BB.nChildNode((XMLCSTR)"install_path") ) - GetTextOrClear(BB.getChildNode((XMLCSTR)"install_path"),mInstall_path); + // if( BB.nChildNode((XMLCSTR)"install_path") ) + // GetTextOrClear(BB.getChildNode((XMLCSTR)"install_path"),mInstall_path); // always add "." (current working directory) at the begining - // bbs_paths mBbs_paths.push_back("."); + // add system bbs path + mBbs_paths.push_back(mBbs_path); + for (i=0,j=0; i