]> Creatis software - bbtk.git/blob - kernel/src/bbtkConfigurationFile.cxx
c79747c0378f512cd63f36182cab6a074831618e
[bbtk.git] / kernel / src / bbtkConfigurationFile.cxx
1 /*
2  # ---------------------------------------------------------------------
3  #
4  # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
5  #                        pour la SantÈ)
6  # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
7  # Previous Authors : Laurent Guigues, Jean-Pierre Roux
8  # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
9  #
10  #  This software is governed by the CeCILL-B license under French law and
11  #  abiding by the rules of distribution of free software. You can  use,
12  #  modify and/ or redistribute the software under the terms of the CeCILL-B
13  #  license as circulated by CEA, CNRS and INRIA at the following URL
14  #  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
15  #  or in the file LICENSE.txt.
16  #
17  #  As a counterpart to the access to the source code and  rights to copy,
18  #  modify and redistribute granted by the license, users are provided only
19  #  with a limited warranty  and the software's author,  the holder of the
20  #  economic rights,  and the successive licensors  have only  limited
21  #  liability.
22  #
23  #  The fact that you are presently reading this means that you have had
24  #  knowledge of the CeCILL-B license and that you accept its terms.
25  # ------------------------------------------------------------------------ */
26
27
28 /*=========================================================================
29   Program:   bbtk
30   Module:    $RCSfile: bbtkConfigurationFile.cxx,v $
31   Language:  C++
32   Date:      $Date: 2012/11/16 08:49:01 $
33   Version:   $Revision: 1.38 $
34 =========================================================================*/
35
36
37
38 /**
39  *\file
40  *\brief Class bbtk::ConfigurationFile
41  */
42
43 #include "bbtkConfigurationFile.h"
44 #include "bbtkMessageManager.h"
45 #include "bbtkXML.h"
46 #include "bbtkUtilities.h"
47
48 #include "creaSystem.h"
49
50 #if defined(WIN32)
51 # include <direct.h> // for getcwd
52 # include <windows.h>
53 #endif
54
55
56 namespace bbtk
57 {
58   //====================================================================
59   /// Constructor
60   ConfigurationFile::ConfigurationFile()
61   {
62     mFile_separator = VALID_FILE_SEPARATOR;
63
64     // ==> Set system paths
65     mBin_path = Utilities::GetExecutablePath();
66
67 /*      EED 23 Mars 2009
68 #ifdef MACOSX
69     mInstall_path = mBin_path + "/../../../..";
70 #else
71     mInstall_path = mBin_path + "/..";
72 #endif
73 */
74 #ifdef MACOSX
75           std::string macPath("Contents/MacOS");
76           int sbp = mBin_path.length();
77           int smp = macPath.length();
78           if (mBin_path.compare( sbp-smp, smp, macPath )==0 )
79           {
80                   mBin_path = mBin_path + "/../../..";
81           }
82 #endif
83
84 ///\TODO : better use ??
85           mInstall_path = mBin_path + "/..";
86
87     // The relative path to the doc folder (=BBTK_DOC_REL_PATH)
88     //    mDoc_rel_path = BBTK_STRINGIFY_SYMBOL(BBTK_DOC_REL_PATH);
89     // The path to the doc folder (=mInstall_path+"/"+mDoc_rel_path)
90     //    mDoc_path = mInstall_path + "/" + mDoc_rel_path;
91     // Have to create bbtk user's dirs if needed
92
93     // LG 27/01/09 : doc is now user dependent
94     //               and located in user's .bbtk dir /doc
95     // All dirs under .bbtk user's dir are set and created by:
96     InitializeDotBbtkStructure();
97
98     // The relative path to the doc folder (=BBTK_BBS_REL_PATH)
99     mBbs_rel_path = BBTK_STRINGIFY_SYMBOL(BBTK_BBS_REL_PATH);
100     // The path to the bbs folder (=mInstall_path+"/"+mBbs_rel_path)
101     mBbs_path = mInstall_path + "/" + mBbs_rel_path;
102
103     mData_path = mInstall_path + "/" + BBTK_STRINGIFY_SYMBOL(BBTK_DATA_REL_PATH);
104
105     Utilities::replace( mBin_path,
106                         INVALID_FILE_SEPARATOR,
107                         VALID_FILE_SEPARATOR);
108     Utilities::replace( mInstall_path,
109                         INVALID_FILE_SEPARATOR,
110                         VALID_FILE_SEPARATOR);
111     Utilities::replace( mBbs_path,
112                         INVALID_FILE_SEPARATOR,
113                         VALID_FILE_SEPARATOR);
114     Utilities::replace( mData_path,
115                         INVALID_FILE_SEPARATOR,
116                         VALID_FILE_SEPARATOR);
117
118     bbtkMessage("config",1," ==> bin    : '"<<mBin_path<<"'"<<std::endl);
119     bbtkMessage("config",1," ==> prefix : '"<<mInstall_path<<"'"<<std::endl);
120     bbtkMessage("config",1," ==> doc    : '"<<mDoc_path<<"'"<<std::endl);
121     bbtkMessage("config",1," ==> bbs    : '"<<mBbs_path<<"'"<<std::endl);
122     bbtkMessage("config",1," ==> data   : '"<<mData_path<<"'"<<std::endl);
123
124     // bbs_paths
125     // always add "." (current working directory) at the begining
126     mBbs_paths.push_back( "." );
127     // add system bbs path
128     mBbs_paths.push_back(mBbs_path);
129     // add toolsbbtk/appli
130 //EED    std::string toolsappli_rel_path(mFile_separator);
131     std::string toolsappli_rel_path("/");
132 //EED    toolsappli_rel_path +=  "toolsbbtk" + mFile_separator + "appli";
133     toolsappli_rel_path +=  "toolsbbtk/appli";
134     //
135     //-----------------------------------------------------------
136     // LG : REMOVE BUGGY PATH WITH include *:
137     //
138     //    mBbs_paths.push_back(mBbs_path + toolsappli_rel_path);
139     //-----------------------------------------------------------
140     int iStrVec,sizeStrVec;
141
142     sizeStrVec = mBbs_paths.size();
143     for (iStrVec=0;iStrVec<sizeStrVec;iStrVec++){
144       Utilities::replace( mBbs_paths[iStrVec] , INVALID_FILE_SEPARATOR , VALID_FILE_SEPARATOR);
145     }
146
147
148     // always add "." (current working directory) at the begining
149     mPackage_paths.push_back(".");
150     // add system bin path (for build tree / standalone folder install)
151     mPackage_paths.push_back(mBin_path);
152     // add system lib path (for install tree)
153     //EED    mPackage_paths.push_back(mInstall_path + mFile_separator + "lib");
154     
155     //mPackage_paths.push_back(mInstall_path + "/lib"); // JPR
156     //mPackage_paths.push_back(mInstall_path + "/lib64");// JPR
157     
158     ///\TODO : better use BBTK_PACKAGE_LIB_PATH  // JPR
159     
160     mPackage_paths.push_back(mInstall_path + "/lib/creatools");
161     mPackage_paths.push_back(mInstall_path + "/lib64/creatools");
162 #ifdef WIN32
163     // add bin/Debug bin/Release paths (for build/install tree)
164     //EED    mPackage_paths.push_back(mBin_path + mFile_separator + "Debug");
165     mPackage_paths.push_back(mBin_path + "/Debug");
166     //EED    mPackage_paths.push_back(mBin_path + mFile_separator + "Release");
167     mPackage_paths.push_back(mBin_path + "/Release");
168 #endif
169
170     sizeStrVec = mPackage_paths.size();
171     for (iStrVec=0;iStrVec<sizeStrVec;iStrVec++){
172       Utilities::replace( mPackage_paths[iStrVec] , INVALID_FILE_SEPARATOR , VALID_FILE_SEPARATOR);
173     }
174
175     GetHelp(2);
176
177     // ==> First we look for bbtk_config.xml in "."
178     char buf[2048];
179     const char *currentDir = getcwd(buf, 2048);
180
181     if( !currentDir )
182       {
183         std::cerr << "Path was too long to fit on 2048 bytes ?!?" << std::endl;
184         // \todo : what else?
185         // How abort a constructor and warn the caller function?
186         // LG : throw an exception
187       }
188
189     //    std::string configXmlFullPathName = currentDir + mFile_separator + "bbtk_config.xml";
190     std::string configXmlFullPathName = currentDir ;
191     configXmlFullPathName += "/bbtk_config.xml";
192     Utilities::replace( configXmlFullPathName , INVALID_FILE_SEPARATOR , VALID_FILE_SEPARATOR);
193
194     if ( Utilities::FileExists( configXmlFullPathName ))
195       {
196         bbtkMessage("config",1, "ConfigurationFile : [" << configXmlFullPathName <<
197                     "] found in current directory" << std::endl);
198         //Read(configXmlFullPathName.c_str());
199         // traiter le fichier local
200       }
201
202     // ==> Then we look for bbtk_config.xml in ".bbtk"
203     else
204       {
205         configXmlFullPathName = Utilities::MakeUserSettingsFullFileName("bbtk_config.xml");
206         if (!Utilities::FileExists( configXmlFullPathName ))
207           {
208             // ==> Nothing found, we create bbtk_config.xml in ".bbtk"
209             InstallPath ();
210           }
211       }
212
213     // In any case, deal with bbtk_config.xml!
214     Read(configXmlFullPathName.c_str());
215   }
216   //=========================================================================
217
218   //=========================================================================
219   /// Destructor
220   ConfigurationFile::~ConfigurationFile()
221   {
222   }
223   //=========================================================================
224
225   //=========================================================================
226   void ConfigurationFile::InitializeDotBbtkStructure()
227   {
228     mDot_bbtk_path = Utilities::GetUserSettingsDir();
229     mDot_bbtk_is_new = false;
230     if (!Utilities::FileExists(mDot_bbtk_path)) mDot_bbtk_is_new = true;
231     Utilities::CreateDirectoryIfNeeded(mDot_bbtk_path);
232
233     mDoc_path = Utilities::MakeUserSettingsFullFileName("doc");
234     Utilities::CreateDirectoryIfNeeded(mDoc_path);
235
236     std::string bbdoc_path =
237       Utilities::MakeUserSettingsFullFileName("doc/bbdoc");
238     Utilities::CreateDirectoryIfNeeded(bbdoc_path);
239
240     // Create help_contents.html if does not exist
241     std::string filename = Utilities::MakeUserSettingsFullFileName("doc/help_contents.html");
242     if (!Utilities::FileExists(filename))
243       {
244                         bbtkDebugMessage("config",1,
245                          "* Creating [" << filename << "]" << std::endl);
246                         // The path to the doc folder (=mInstall_path+"/"+mDoc_rel_path)
247                         std::string doc_path = mInstall_path + "/"
248                           + BBTK_STRINGIFY_SYMBOL(BBTK_DOC_REL_PATH) + "/";
249                         Utilities::MakeValidFileName(doc_path);
250
251                         std::ofstream f;
252                         f.open(filename.c_str(), std::ios::out );
253                         f << "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD "
254                           << "HTML 4.01 Transitional//EN\">"
255                           << "<html><head><title>Help Contents - bbtk "
256                           << GetVersion() << "</title>"
257                           << "<meta http-equiv=\"Content-Type\" content=\"text/html; "
258                           << "charset=iso-8859-1\"></head><H1>Help Contents</H1>"
259                           << "<a href=\"bbdoc/index-category.html#demo\" "
260                           << "target=\"information\">Demos</a><br>"
261                           << "<a href=\"bbdoc/index-category.html#example\" "
262                           << "target=\"information\">Examples</a>"
263                           << "<H2>Guides</H2>"
264                           << "<a href=\""
265                           << doc_path
266                           << "bbtkUsersGuide/bbtkUsersGuide.pdf"
267                           << "\" target=\"information\">User's Guide</a><br>"
268                           << "<a href=\""
269                           << doc_path
270                           << "bbtkDevelopersGuide/bbtkDevelopersGuide.pdf"
271                           << "\" target=\"information\">Developer's Guide</a><br>"
272                           << "<a href=\""
273                           << doc_path
274                           << "bbtkPackageDevelopersGuide/bbtkPackageDevelopersGuide.pdf"
275                           << "\" target=\"information\">Package Developer's Guide</a><br>"
276                           << "<a href=\""
277                           << doc_path
278                           << "doxygen/bbtk/main.html"
279                           << "\" target=\"information\">bbtk library doxygen doc</a><br>"
280                           << "<H2>Boxes</H2>"
281                           << "<a target=\"information\" href=\"bbdoc/index-alpha.html\">"
282                           << "Alphabetical list</a><br>"
283                           << "<a target=\"information\" href=\"bbdoc/index-package.html\">"
284                           << "List by package</a><br>"
285                           << "<a target=\"information\" href=\"bbdoc/index-category.html\">"
286                           << "List by category</a><br>"
287                           << "<a target=\"information\" href=\"bbdoc/index-adaptors.html\">"
288                           << "List of adaptors</a><br>"
289                           << "</body>"
290                   << "</html>";
291       } // if
292
293     mTemp_path = Utilities::MakeUserSettingsFullFileName("tmp");
294     Utilities::CreateDirectoryIfNeeded(mTemp_path);
295
296   }
297   //=========================================================================
298
299   //=========================================================================
300   void ConfigurationFile::CreateConfigXML( char *rootDirectory )
301   {
302     FILE *fp;
303     char configXml[250];
304     sprintf (configXml , "%s/bbtk_config.xml", rootDirectory);
305     bbtkDebugMessage("config",1, "in CreateConfigXML[" << configXml << "]" << std::endl);
306     fp = fopen (configXml, "w");
307     fprintf(fp, "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n");
308     fprintf(fp, "<config>\n");
309     fprintf(fp, "   <bbs_path>     </bbs_path>\n");
310     fprintf(fp, "   <package_path> </package_path>\n");
311     fprintf(fp, "</config>\n");
312     fclose(fp);
313   }
314   //=========================================================================
315
316
317
318
319   //=========================================================================
320   void ConfigurationFile::InstallPath ()
321   {
322
323     /*--------------------------------------------------
324       New policy for bbtk_config.xml :
325
326       if bbtk_config.xml found in current directory (user is an aware user!)
327       use it!
328
329       else if bbtk_config.xml found in HOME/.bbtk (user already worked with it)
330       use it!
331
332       else if bbtk_config.xml.tmp found in /usr/local/bin or c:\\Program Files\\BBTK\\bin
333       copy it as .bbtk/bbtk_config.xml
334
335       else (nothing installed)
336       create a minimum version in HOME/.bbtk
337       ----------------------------------------------------*/
338
339
340     // -----------------------------------------------------------------
341 #if defined(__GNUC__)
342
343     // ------------------ create some usefull strings ----------------
344     // installed bbtk_path
345     char bbtk_path[1000];
346     strcpy(bbtk_path, Utilities::GetExecutablePath().c_str());  // JPR
347     //strcpy(bbtk_path, "/usr/local/bin");
348
349     // rootDirectory
350     char rootDirectory[200];
351     sprintf( rootDirectory,  "%s/.bbtk", getenv("HOME"));
352
353     // configPath
354     char configPath[200];
355     sprintf(configPath, "%s/bbtk_config.xml",rootDirectory);
356
357     // configXmlTmp
358     char configXmlTmp[250];
359     sprintf(configXmlTmp, "%s/bbtk_config.xml.tmp", bbtk_path);
360
361     // copyFile
362     char copyFile[250];
363
364     if (!Utilities::FileExists(configXmlTmp)) // bbtk_config.xml.tmp not found (not installed)
365       {
366         // if "bbtk_path/bbtk_config.xml.tmp" doesn't exist, hard-create a minimum version in .bbtk
367         CreateConfigXML( rootDirectory );// create .bbtk
368       }
369     else
370       {
371         sprintf(copyFile,"cp %s  %s/bbtk_config.xml ",configXmlTmp,rootDirectory );
372         if (!Utilities::FileExists(configPath))
373           {
374             system(copyFile);
375           }
376       }
377     return;
378
379     // ------------------------------------------------------------------
380 #elif defined(WIN32)
381
382
383     // installed bbtk_path
384     char bbtk_path[100];
385     strcpy(bbtk_path, "\"c:\\Program Files\\BBTK\\bin\"");
386     char bbtk_path2[100];
387     strcpy(bbtk_path2, "c:\\Program Files\\BBTK\\bin");
388
389     // rootDirectory
390     char rootDirectory[200];
391     sprintf(rootDirectory, "%s\\.bbtk",getenv("USERPROFILE"));
392     //  std::cout << "[" << rootDirectory << "]" << std::endl;
393
394     // configPath
395     char configPath[200];
396     sprintf(configPath, "%s\\bbtk_config.xml",rootDirectory);
397
398     // makeDir
399     char makeDir[250];
400     sprintf( makeDir, "mkdir \"%s\" ", rootDirectory);
401
402     // configXmlTmp
403     char configXmlTmp[250];
404     sprintf(configXmlTmp, "%s\\bbtk_config.xml.tmp", bbtk_path2);
405
406     // copyFile
407     char copyFile[250];
408
409     if (!Utilities::FileExists(configXmlTmp)) // bbtk_config.xml.tmp not found
410       {
411         // if "bbtk_path/bbtk_config.xml.tmp" doesn't exist, hard-create a minimum version in .bbtk
412         CreateConfigXML( rootDirectory );// create .bbtk
413         return;
414       }
415
416     sprintf(copyFile,"copy %s\\bbtk_config.xml.tmp \"%s\"\\bbtk_config.xml ",bbtk_path,rootDirectory );
417
418     int attribs = GetFileAttributes (rootDirectory);
419     bbtkMessage("config",1,std::hex << attribs << " " << FILE_ATTRIBUTE_DIRECTORY << std::endl);
420     if ( attribs != 0xFFFFFFFF)
421       {
422         if ((attribs & FILE_ATTRIBUTE_DIRECTORY) == FILE_ATTRIBUTE_DIRECTORY ) /// \TODO : check !
423           {
424             if ( GetFileAttributes( configPath ) == 0xFFFFFFFF)
425               {
426                 system(copyFile);
427               }
428           }
429       }
430     else
431       {
432         system(makeDir);
433         system(copyFile);
434       }
435     return;
436     // ------------------------------------------------------------------
437 #else
438 /// \todo  ConfigurationFile::InstallPath() : exit when for not WIN32 and not__GNUC__
439
440   return;
441 #endif
442
443 }
444   //=========================================================================
445
446
447
448   //=========================================================================
449   // Gets the list of directories holding bb scripts, packages, dll, ... from the xml file
450   //      bbtk_config.xml
451
452   void ConfigurationFile::Read(const std::string& filename)
453   {
454
455     bbtkDebugMessage("config",1,"ConfigurationFile::Read(" <<filename << ")" << std::endl);
456
457     mConfig_xml_full_path = filename;
458     XMLResults* res = new XMLResults;
459     XMLNode BB = XMLNode::parseFile((XMLCSTR)filename.c_str(),(XMLCSTR)"config",res);
460
461     if ( res->error != eXMLErrorNone )
462       {
463         std::string mess = GetErrorMessage(res,filename);
464         delete res;
465         bbtkDebugMessage("config",1,mess<< std::endl);
466         bbtkError(mess);
467       }
468     delete res;
469
470     bbtkDebugMessage("config",1,"OK" << std::endl);
471
472     int i,j;
473
474     // Description
475     for (i=0,j=0; i<BB.nChildNode((XMLCSTR)"description"); i++)
476       {
477         std::string val;
478         GetTextOrClear(BB.getChildNode((XMLCSTR)"description",&j),val);
479         mDescription += val;
480       }
481
482     // Url
483     if( BB.nChildNode((XMLCSTR)"url") )
484       GetTextOrClear(BB.getChildNode((XMLCSTR)"url"),mUrl);
485
486     // Data_Path
487     if( BB.nChildNode((XMLCSTR)"data_path") )
488       GetTextOrClear(BB.getChildNode((XMLCSTR)"data_path"),mData_path);
489
490     // install_path
491     //  if( BB.nChildNode((XMLCSTR)"install_path") )
492     //   GetTextOrClear(BB.getChildNode((XMLCSTR)"install_path"),mInstall_path);
493
494     // add user bbs paths
495     for (i=0,j=0; i<BB.nChildNode((XMLCSTR)"bbs_path"); i++)
496       {
497         std::string val;
498         GetTextOrClear(BB.getChildNode((XMLCSTR)"bbs_path",&j),val);
499         mBbs_paths.push_back(val);
500       }
501
502     // package_paths
503
504     // add user package path
505     for (i=0,j=0; i<BB.nChildNode((XMLCSTR)"package_path"); i++)
506       {
507         std::string val;
508         GetTextOrClear(BB.getChildNode((XMLCSTR)"package_path",&j),val);
509         mPackage_paths.push_back(val);
510       }
511
512     // default_temp_dir
513     /*
514     if( BB.nChildNode((XMLCSTR)"default_temp_dir") )
515       GetTextOrClear(BB.getChildNode((XMLCSTR)"default_temp_dir"),mDefault_temp_dir);
516
517     if ( mDefault_temp_dir == "$") // no value found in config_xml
518       {
519         size_t pos = mConfig_xml_full_path.find("bbtk_config.xml");
520         mDefault_temp_dir = mConfig_xml_full_path.substr (0,pos);
521       }
522     */
523
524     GetHelp(2);
525   }
526   //=========================================================================
527
528   //=========================================================================
529   bool ConfigurationFile::AddPackagePathsAndWrite( const std::string& path )
530   {
531     bbtkDebugMessageInc("config",9,
532                         "ConfigurationFile::AddPackagePathsAndWrite("
533                         <<path<<")"<<std::endl);
534
535      XMLResults* res = new XMLResults;
536     XMLNode BB =
537       XMLNode::parseFile((XMLCSTR)Get_config_xml_full_path().c_str(),
538                          (XMLCSTR)"config",res);
539
540     if ( res->error != eXMLErrorNone )
541       {
542         std::string mess = GetErrorMessage(res,Get_config_xml_full_path());
543         delete res;
544         bbtkDebugMessage("config",1,mess<< std::endl);
545         bbtkError(mess);
546       }
547    delete res;
548
549 #ifdef _WIN32
550     std::string bbs_path = path + "/bbs";
551 #else
552     std::string bbs_path = path + "/share/bbtk/bbs" ;
553 #endif
554     XMLNode BBSPATH = BB.addChild((XMLCSTR)"bbs_path");
555     BBSPATH.addText((XMLCSTR)bbs_path.c_str());
556     Utilities::replace(bbs_path, INVALID_FILE_SEPARATOR, VALID_FILE_SEPARATOR);
557     mBbs_paths.push_back(bbs_path);
558
559 #ifdef _WIN32
560     std::string pack_path = path + "/bin";
561 #else
562     std::string pack_path = path ;
563 #endif
564     XMLNode PACKPATH = BB.addChild((XMLCSTR)"package_path");
565     PACKPATH.addText((XMLCSTR)pack_path.c_str());
566     Utilities::replace(pack_path,INVALID_FILE_SEPARATOR,VALID_FILE_SEPARATOR);
567     mPackage_paths.push_back(pack_path);
568
569 #ifdef _WIN32
570     pack_path = path + "/RelWithDebInfo";
571     PACKPATH = BB.addChild((XMLCSTR)"package_path");
572     PACKPATH.addText((XMLCSTR)pack_path.c_str());
573     Utilities::replace(pack_path,INVALID_FILE_SEPARATOR,VALID_FILE_SEPARATOR);
574     mPackage_paths.push_back(pack_path);
575     pack_path = path + "/Debug";
576     PACKPATH = BB.addChild((XMLCSTR)"package_path");
577     PACKPATH.addText((XMLCSTR)pack_path.c_str());
578     Utilities::replace(pack_path,INVALID_FILE_SEPARATOR,VALID_FILE_SEPARATOR);
579     mPackage_paths.push_back(pack_path);
580     pack_path = path + "/Release";
581     PACKPATH = BB.addChild((XMLCSTR)"package_path");
582     PACKPATH.addText((XMLCSTR)pack_path.c_str());
583     Utilities::replace(pack_path,INVALID_FILE_SEPARATOR,VALID_FILE_SEPARATOR);
584     mPackage_paths.push_back(pack_path);
585 #endif
586
587
588     XMLError err = BB.writeToFile((XMLCSTR)Get_config_xml_full_path().c_str());
589     if ( err != eXMLErrorNone )
590       {
591         std::string mess = GetErrorMessage(res,Get_config_xml_full_path());
592         bbtkDebugMessage("config",1,mess<< std::endl);
593         bbtkError(mess);
594       }
595
596     return true;
597   }
598   //=========================================================================
599
600   //=========================================================================
601   void ConfigurationFile::GetHelp(int level) const
602   {
603     bbtkDebugMessageInc("config",9,"ConfigurationFile::GetHelp("<<level
604                         <<")"<<std::endl);
605
606     const std::string config_xml_full_path      = Get_config_xml_full_path();
607     const std::string description               = Get_description();
608     const std::string url                       = Get_doc_path();
609     const std::string data_path                 = Get_data_path();
610     const std::string default_temp_dir          = Get_default_temp_dir();
611     const std::string file_separator            = Get_file_separator();
612     const std::vector<std::string>bbs_paths     = Get_bbs_paths();
613     const std::vector<std::string>package_paths = Get_package_paths();
614
615     bbtkMessage("help",level, "============="   << std::endl);
616     bbtkMessage("help",level, "Configuration"   << std::endl);
617     bbtkMessage("help",level, "============="   << std::endl);
618     bbtkMessage("help",level, "bbtk_config.xml    : [" << config_xml_full_path  << "]" << std::endl);
619     bbtkMessage("help",level, "Documentation Path : [" << url             << "]" << std::endl);
620     bbtkMessage("help",level, "Data Path          : [" << data_path       << "]" << std::endl);
621     bbtkMessage("help",level, "Temp Directory     : [" << default_temp_dir << "]" << std::endl);
622     bbtkMessage("help",level, "File Separator     : [" << file_separator  << "]" << std::endl);
623
624     std::vector<std::string>::const_iterator i;
625
626     bbtkMessage("help",level, "BBS Paths   " << std::endl);
627     for (i = bbs_paths.begin(); i!=bbs_paths.end(); ++i )
628     {
629       bbtkMessage("help",level,"--- ["<<*i<<"]"<<std::endl);
630     }
631
632     bbtkMessage("help",level, "PACKAGE Paths : " << std::endl);
633     for (i = package_paths.begin(); i!=package_paths.end(); ++i )
634     {
635       bbtkMessage("help",level,"--- ["<<*i<<"]"<<std::endl);
636     }
637
638     bbtkDebugDecTab("config",9);
639   }
640   //=========================================================================
641
642
643 } // namespace bbtk