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
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 : '"<<mBin_path<<"'"<<std::endl);
+ bbtkMessage("Config",1," ==> prefix : '"<<mInstall_path<<"'"<<std::endl);
+ bbtkMessage("Config",1," ==> doc : '"<<mDoc_path<<"'"<<std::endl);
+ bbtkMessage("Config",1," ==> bbs : '"<<mBbs_path<<"'"<<std::endl);
+ // bbtkMessage("Config",1," ==> rsc : '"<<mRsc_path<<"'"<<std::endl);
+ bbtkMessage("Config",1," ==> data : '"<<mData_path<<"'"<<std::endl);
+
+ // ==> 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";
bbtkMessage("Config",1, "in CreateConfigXML[" << configXml << "]" << std::endl);
fp = fopen (configXml, "w");
fprintf(fp, "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n");
- fprintf(fp, "<!DOCTYPE config SYSTEM \"/mnt/windows/bbtk/bbtk_config.xml>\n");
+ // fprintf(fp, "<!DOCTYPE config SYSTEM \"/mnt/windows/bbtk/bbtk_config.xml>\n");
fprintf(fp, "<config>\n");
fprintf(fp, " <description> </description>\n");
- fprintf(fp, " <url> http://www.creatis.insa-lyon.fr/software/bbtk </url>\n");
- fprintf(fp, " <install_path> </install_path>\n");
+ // fprintf(fp, " <url> http://www.creatis.insa-lyon.fr/software/bbtk </url>\n");
+ // fprintf(fp, " <install_path> </install_path>\n");
fprintf(fp, " <bbs_path> </bbs_path>\n");
// fprintf(fp, " <ext_dll_path> </ext_dll_path>\n");
fprintf(fp, " <package_path> </package_path>\n");
- fprintf(fp, " <data_path> %s </data_path>\n", BBTK_DATA_PATH);
+ fprintf(fp, " <data_path> </data_path>\n");//, BBTK_DATA_PATH);
/// \todo find a decent default value !
///fprintf(fp, " <default_temp_dir> %s </default_temp_dir>\n", " ");
// when $ will be found, default_temp_dir value will be replaced
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<BB.nChildNode((XMLCSTR)"bbs_path"); i++)
{
std::string val;