X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=kernel%2Fsrc%2FbbtkConfigurationFile.cxx;h=f19f5075f6bc7fc11b7a1bed711ed20a40a7fd5c;hb=cf155931d4fded21cd2aaaeb0f3ead82067d2bef;hp=1d8c302753c6bc8b91836de1fe06e243c5d858a5;hpb=8a15ae69662abfba701a970f9efee218e0b126d3;p=bbtk.git diff --git a/kernel/src/bbtkConfigurationFile.cxx b/kernel/src/bbtkConfigurationFile.cxx index 1d8c302..f19f507 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/03/17 10:51:35 $ - Version: $Revision: 1.14 $ + Date: $Date: 2008/10/15 13:02:14 $ + Version: $Revision: 1.16 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See doc/license.txt or @@ -157,15 +157,7 @@ namespace bbtk // ==> Then we look for bbtk_config.xml in ".bbtk" else { -#if defined(__GNUC__) - std::string str_home(getenv("HOME")); -#elif defined(_WIN32) - std::string str_home(getenv("USERPROFILE")); -#endif -//EED configXmlFullPathName = str_home + mFile_separator + ".bbtk/bbtk_config.xml"; - configXmlFullPathName = str_home + "/.bbtk/bbtk_config.xml"; - Utilities::replace( configXmlFullPathName , INVALID_FILE_SEPARATOR , VALID_FILE_SEPARATOR); - + configXmlFullPathName = Utilities::MakeUserSettingsFullFileName("bbtk_config.xml"); if (!Utilities::FileExists( configXmlFullPathName )) { // ==> Nothing found, we create bbtk_config.xml in ".bbtk" @@ -477,6 +469,59 @@ namespace bbtk } //========================================================================= + //========================================================================= + bool ConfigurationFile::AddPackagePathsAndWrite( const std::string& path ) + { + bbtkDebugMessageInc("Config",9, + "ConfigurationFile::AddPackagePathsAndWrite(" + <error != eXMLErrorNone ) + { + std::string mess = GetErrorMessage(res,Get_config_xml_full_path()); + delete res; + bbtkDebugMessage("Config",1,mess<< std::endl); + bbtkError(mess); + } + delete res; + +#ifdef _WIN32 + std::string bbs_path = path + "/bbs"; +#else + std::string bbs_path = path + "/share/bbtk/bbs" ; +#endif + XMLNode BBSPATH = BB.addChild((XMLCSTR)"bbs_path"); + BBSPATH.addText((XMLCSTR)bbs_path.c_str()); + Utilities::replace(bbs_path, INVALID_FILE_SEPARATOR, VALID_FILE_SEPARATOR); + mBbs_paths.push_back(bbs_path); + +#ifdef _WIN32 + std::string pack_path = path + "/bin"; + std::string pack_path = path + "/lib"; +#else + std::string pack_path = path ; +#endif + XMLNode PACKPATH = BB.addChild((XMLCSTR)"package_path"); + PACKPATH.addText((XMLCSTR)pack_path.c_str()); + Utilities::replace(pack_path,INVALID_FILE_SEPARATOR,VALID_FILE_SEPARATOR); + mPackage_paths.push_back(pack_path); + + XMLError err = BB.writeToFile((XMLCSTR)Get_config_xml_full_path().c_str()); + if ( err != eXMLErrorNone ) + { + std::string mess = GetErrorMessage(res,Get_config_xml_full_path()); + bbtkDebugMessage("Config",1,mess<< std::endl); + bbtkError(mess); + } + + return true; + } + //========================================================================= //========================================================================= void ConfigurationFile::GetHelp(int level) const