]> Creatis software - bbtk.git/blobdiff - kernel/src/bbtkConfigurationFile.cxx
#3510 Bug Install bbtk package Linux MacOs
[bbtk.git] / kernel / src / bbtkConfigurationFile.cxx
index 2b246b578ffeb5beb873a26821624aed681da0d2..c8d66306891ec1f210ff704e67a2c51c2581d884 100644 (file)
@@ -169,9 +169,10 @@ namespace bbtk
 #endif
 
     sizeStrVec = mPackage_paths.size();
-    for (iStrVec=0;iStrVec<sizeStrVec;iStrVec++){
+    for (iStrVec=0 ; iStrVec<sizeStrVec ; iStrVec++)
+    {
       Utilities::replace( mPackage_paths[iStrVec] , INVALID_FILE_SEPARATOR , VALID_FILE_SEPARATOR);
-    }
+    } // for iStrVec
 
     GetHelp(2);
 
@@ -193,23 +194,19 @@ namespace bbtk
     Utilities::replace( configXmlFullPathName , INVALID_FILE_SEPARATOR , VALID_FILE_SEPARATOR);
 
     if ( Utilities::FileExists( configXmlFullPathName ))
-      {
-       bbtkMessage("config",1, "ConfigurationFile : [" << configXmlFullPathName <<
-                   "] found in current directory" << std::endl);
-       //Read(configXmlFullPathName.c_str());
-       // traiter le fichier local
-      }
-
-    // ==> Then we look for bbtk_config.xml in ".bbtk"
-    else
-      {
-       configXmlFullPathName = Utilities::MakeUserSettingsFullFileName("bbtk_config.xml");
-       if (!Utilities::FileExists( configXmlFullPathName ))
-         {
-           // ==> Nothing found, we create bbtk_config.xml in ".bbtk"
-           InstallPath ();
-         }
-      }
+    {
+        bbtkMessage("config",1, "ConfigurationFile : [" << configXmlFullPathName <<
+                    "] found in current directory" << std::endl);
+        //Read(configXmlFullPathName.c_str());
+        // traiter le fichier local
+    }    else {   // ==> Then we look for bbtk_config.xml in ".bbtk"
+        configXmlFullPathName = Utilities::MakeUserSettingsFullFileName("bbtk_config.xml");
+        if (!Utilities::FileExists( configXmlFullPathName ))
+        {
+            // ==> Nothing found, we create bbtk_config.xml in ".bbtk"
+            InstallPath ();
+        } 
+    }
 
     // In any case, deal with bbtk_config.xml!
     Read(configXmlFullPathName.c_str());
@@ -323,7 +320,6 @@ namespace bbtk
   //=========================================================================
   void ConfigurationFile::InstallPath ()
   {
-
     /*--------------------------------------------------
       New policy for bbtk_config.xml :
 
@@ -448,6 +444,7 @@ namespace bbtk
                    system(copyFile);
                } // FileExists configPath
     } // FileExists configXmlTmp
+      
     return;
 
     // ------------------------------------------------------------------
@@ -554,7 +551,7 @@ namespace bbtk
       XMLNode::parseFile((XMLCSTR)Get_config_xml_full_path().c_str(),
                         (XMLCSTR)"config",res);
 
-    if ( res->error != eXMLErrorNone )
+      if ( res->error != eXMLErrorNone )
       {
        std::string mess = GetErrorMessage(res,Get_config_xml_full_path());
        delete res;
@@ -639,15 +636,13 @@ namespace bbtk
 #ifdef _WIN32
 #endif
 
-
     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);
-      }
-
+    {
+        std::string mess = GetErrorMessage(res,Get_config_xml_full_path());
+        bbtkDebugMessage("config",1,mess<< std::endl);
+        bbtkError(mess);
+    } // if err
     return true;
   }
   //=========================================================================