Program: bbtk
Module: $RCSfile: bbtkConfigurationFile.cxx,v $
Language: C++
- Date: $Date: 2009/01/28 11:54:04 $
- Version: $Revision: 1.27 $
+ Date: $Date: 2009/12/08 14:10:36 $
+ Version: $Revision: 1.32 $
=========================================================================*/
/* ---------------------------------------------------------------------
ConfigurationFile::ConfigurationFile()
{
- mFile_separator = VALID_FILE_SEPARATOR;
+ mFile_separator = VALID_FILE_SEPARATOR;
// ==> Set system paths
mBin_path = Utilities::GetExecutablePath();
-
+
+
+
+
+/* EED 23 Mars 2009
#ifdef MACOSX
mInstall_path = mBin_path + "/../../../..";
#else
mInstall_path = mBin_path + "/..";
#endif
-
-
+*/
+#ifdef MACOSX
+
+ std::string macPath("Contents/MacOS");
+ int sbp = mBin_path.length();
+ int smp = macPath.length();
+ if (mBin_path.compare( sbp-smp, smp, macPath )==0 )
+ {
+ mBin_path = mBin_path + "/../../..";
+ }
+
+
+#endif
+ mInstall_path = mBin_path + "/..";
+
+
+
// 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)
INVALID_FILE_SEPARATOR,
VALID_FILE_SEPARATOR);
- 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," ==> data : '"<<mData_path<<"'"<<std::endl);
+ 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," ==> data : '"<<mData_path<<"'"<<std::endl);
if ( Utilities::FileExists( configXmlFullPathName ))
{
- bbtkMessage("Config",1, "ConfigurationFile : [" << configXmlFullPathName <<
+ bbtkMessage("config",1, "ConfigurationFile : [" << configXmlFullPathName <<
"] found in current directory" << std::endl);
//Read(configXmlFullPathName.c_str());
// traiter le fichier local
std::string filename = Utilities::MakeUserSettingsFullFileName("doc/help_contents.html");
if (!Utilities::FileExists(filename))
{
- bbtkDebugMessage("Config",1,
+ bbtkDebugMessage("config",1,
"* Creating [" << filename << "]" << std::endl);
- // The path to the doc folder (=mInstall_path+"/"+mDoc_rel_path)
- std::string doc_path = mInstall_path + "/"
- + BBTK_STRINGIFY_SYMBOL(BBTK_DOC_REL_PATH) + "/";
- Utilities::MakeValidFileName(doc_path);
- std::ofstream f;
- f.open(filename.c_str(), std::ios::out );
- f << "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD "
- << "HTML 4.01 Transitional//EN\">"
- << "<html><head><title>Help Contents - bbtk "
- << GetVersion() << "</title>"
- << "<meta http-equiv=\"Content-Type\" content=\"text/html; "
- << "charset=iso-8859-1\"></head><H1>Help Contents</H1>"
- << "<a href=\"bbdoc/index-category.html#demo\" "
- << "target=\"information\">Demos</a><br>"
- << "<a href=\"bbdoc/index-category.html#example\" "
- << "target=\"information\">Examples</a>"
- << "<H2>Guides</H2>"
- << "<a href=\""
- << doc_path
- << "bbtkUsersGuide/bbtkUsersGuide.html"
- << "\" target=\"information\">User's Guide</a><br>"
- << "<a href=\""
- << doc_path
- << "bbtkPackageDevelopersGuide/bbtkPackageDevelopersGuide.html"
- << "\" target=\"information\">Package Developer's Guide</a><br>"
- << "<a href=\""
- << doc_path
- << "doxygen/bbtk/main.html"
- << "\" target=\"information\">bbtk library doxygen doc</a><br>"
- << "<H2>Boxes</H2>"
- << "<a target=\"information\" href=\"bbdoc/index-alpha.html\">"
- << "Alphabetical list</a><br>"
- << "<a target=\"information\" href=\"bbdoc/index-package.html\">"
- << "List by package</a><br>"
- << "<a target=\"information\" href=\"bbdoc/index-category.html\">"
- << "List by category</a><br>"
- << "<a target=\"information\" href=\"bbdoc/index-adaptors.html\">"
- << "List of adaptors</a><br>"
- << "</body>"
- << "</html>";
- }
+ // The path to the doc folder (=mInstall_path+"/"+mDoc_rel_path)
+ std::string doc_path = mInstall_path + "/"
+ + BBTK_STRINGIFY_SYMBOL(BBTK_DOC_REL_PATH) + "/";
+ Utilities::MakeValidFileName(doc_path);
+
+ std::ofstream f;
+ f.open(filename.c_str(), std::ios::out );
+ f << "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD "
+ << "HTML 4.01 Transitional//EN\">"
+ << "<html><head><title>Help Contents - bbtk "
+ << GetVersion() << "</title>"
+ << "<meta http-equiv=\"Content-Type\" content=\"text/html; "
+ << "charset=iso-8859-1\"></head><H1>Help Contents</H1>"
+ << "<a href=\"bbdoc/index-category.html#demo\" "
+ << "target=\"information\">Demos</a><br>"
+ << "<a href=\"bbdoc/index-category.html#example\" "
+ << "target=\"information\">Examples</a>"
+ << "<H2>Guides</H2>"
+ << "<a href=\""
+ << doc_path
+ << "bbtkUsersGuide/bbtkUsersGuide.pdf"
+ << "\" target=\"information\">User's Guide</a><br>"
+ << "<a href=\""
+ << doc_path
+ << "bbtkDevelopersGuide/bbtkDevelopersGuide.pdf"
+ << "\" target=\"information\">Developer's Guide</a><br>"
+ << "<a href=\""
+ << doc_path
+ << "bbtkPackageDevelopersGuide/bbtkPackageDevelopersGuide.pdf"
+ << "\" target=\"information\">Package Developer's Guide</a><br>"
+ << "<a href=\""
+ << doc_path
+ << "doxygen/bbtk/main.html"
+ << "\" target=\"information\">bbtk library doxygen doc</a><br>"
+ << "<H2>Boxes</H2>"
+ << "<a target=\"information\" href=\"bbdoc/index-alpha.html\">"
+ << "Alphabetical list</a><br>"
+ << "<a target=\"information\" href=\"bbdoc/index-package.html\">"
+ << "List by package</a><br>"
+ << "<a target=\"information\" href=\"bbdoc/index-category.html\">"
+ << "List by category</a><br>"
+ << "<a target=\"information\" href=\"bbdoc/index-adaptors.html\">"
+ << "List of adaptors</a><br>"
+ << "</body>"
+ << "</html>";
+ } // if
mTemp_path = Utilities::MakeUserSettingsFullFileName("tmp");
Utilities::CreateDirectoryIfNeeded(mTemp_path);
FILE *fp;
char configXml[250];
sprintf (configXml , "%s/bbtk_config.xml", rootDirectory);
- bbtkDebugMessage("Config",1, "in CreateConfigXML[" << configXml << "]" << std::endl);
+ bbtkDebugMessage("config",1, "in CreateConfigXML[" << configXml << "]" << std::endl);
fp = fopen (configXml, "w");
fprintf(fp, "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n");
fprintf(fp, "<config>\n");
sprintf(copyFile,"copy %s\\bbtk_config.xml.tmp \"%s\"\\bbtk_config.xml ",bbtk_path,rootDirectory );
int attribs = GetFileAttributes (rootDirectory);
- bbtkMessage("Config",1,std::hex << attribs << " " << FILE_ATTRIBUTE_DIRECTORY << std::endl);
+ bbtkMessage("config",1,std::hex << attribs << " " << FILE_ATTRIBUTE_DIRECTORY << std::endl);
if ( attribs != 0xFFFFFFFF)
{
if ((attribs & FILE_ATTRIBUTE_DIRECTORY) == FILE_ATTRIBUTE_DIRECTORY ) /// \TODO : check !
void ConfigurationFile::Read(const std::string& filename)
{
- bbtkDebugMessage("Config",1,"ConfigurationFile::Read(" <<filename << ")" << std::endl);
+ bbtkDebugMessage("config",1,"ConfigurationFile::Read(" <<filename << ")" << std::endl);
mConfig_xml_full_path = filename;
XMLResults* res = new XMLResults;
{
std::string mess = GetErrorMessage(res,filename);
delete res;
- bbtkDebugMessage("Config",1,mess<< std::endl);
+ bbtkDebugMessage("config",1,mess<< std::endl);
bbtkError(mess);
}
delete res;
- bbtkDebugMessage("Config",1,"OK" << std::endl);
+ bbtkDebugMessage("config",1,"OK" << std::endl);
int i,j;
//=========================================================================
bool ConfigurationFile::AddPackagePathsAndWrite( const std::string& path )
{
- bbtkDebugMessageInc("Config",9,
+ bbtkDebugMessageInc("config",9,
"ConfigurationFile::AddPackagePathsAndWrite("
<<path<<")"<<std::endl);
{
std::string mess = GetErrorMessage(res,Get_config_xml_full_path());
delete res;
- bbtkDebugMessage("Config",1,mess<< std::endl);
+ bbtkDebugMessage("config",1,mess<< std::endl);
bbtkError(mess);
}
delete res;
mPackage_paths.push_back(pack_path);
#ifdef _WIN32
+ pack_path = path + "/RelWithDebInfo";
+ 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);
pack_path = path + "/Debug";
PACKPATH = BB.addChild((XMLCSTR)"package_path");
PACKPATH.addText((XMLCSTR)pack_path.c_str());
if ( err != eXMLErrorNone )
{
std::string mess = GetErrorMessage(res,Get_config_xml_full_path());
- bbtkDebugMessage("Config",1,mess<< std::endl);
+ bbtkDebugMessage("config",1,mess<< std::endl);
bbtkError(mess);
}
//=========================================================================
void ConfigurationFile::GetHelp(int level) const
{
- bbtkDebugMessageInc("Config",9,"ConfigurationFile::GetHelp("<<level
+ bbtkDebugMessageInc("config",9,"ConfigurationFile::GetHelp("<<level
<<")"<<std::endl);
const std::string config_xml_full_path = Get_config_xml_full_path();
const std::vector<std::string>bbs_paths = Get_bbs_paths();
const std::vector<std::string>package_paths = Get_package_paths();
- bbtkMessage("Help",level, "=============" << std::endl);
- bbtkMessage("Help",level, "Configuration" << std::endl);
- bbtkMessage("Help",level, "=============" << std::endl);
- bbtkMessage("Help",level, "bbtk_config.xml : [" << config_xml_full_path << "]" << std::endl);
- bbtkMessage("Help",level, "Documentation Path : [" << url << "]" << std::endl);
- bbtkMessage("Help",level, "Data Path : [" << data_path << "]" << std::endl);
- bbtkMessage("Help",level, "Temp Directory : [" << default_temp_dir << "]" << std::endl);
- bbtkMessage("Help",level, "File Separator : [" << file_separator << "]" << std::endl);
+ bbtkMessage("help",level, "=============" << std::endl);
+ bbtkMessage("help",level, "Configuration" << std::endl);
+ bbtkMessage("help",level, "=============" << std::endl);
+ bbtkMessage("help",level, "bbtk_config.xml : [" << config_xml_full_path << "]" << std::endl);
+ bbtkMessage("help",level, "Documentation Path : [" << url << "]" << std::endl);
+ bbtkMessage("help",level, "Data Path : [" << data_path << "]" << std::endl);
+ bbtkMessage("help",level, "Temp Directory : [" << default_temp_dir << "]" << std::endl);
+ bbtkMessage("help",level, "File Separator : [" << file_separator << "]" << std::endl);
std::vector<std::string>::const_iterator i;
- bbtkMessage("Help",level, "BBS Paths " << std::endl);
+ bbtkMessage("help",level, "BBS Paths " << std::endl);
for (i = bbs_paths.begin(); i!=bbs_paths.end(); ++i )
{
- bbtkMessage("Help",level,"--- ["<<*i<<"]"<<std::endl);
+ bbtkMessage("help",level,"--- ["<<*i<<"]"<<std::endl);
}
- bbtkMessage("Help",level, "PACKAGE Paths : " << std::endl);
+ bbtkMessage("help",level, "PACKAGE Paths : " << std::endl);
for (i = package_paths.begin(); i!=package_paths.end(); ++i )
{
- bbtkMessage("Help",level,"--- ["<<*i<<"]"<<std::endl);
+ bbtkMessage("help",level,"--- ["<<*i<<"]"<<std::endl);
}
- bbtkDebugDecTab("Config",9);
+ bbtkDebugDecTab("config",9);
}
//=========================================================================