]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
Fix Bug with USER_CATALOG_RESOURCES_FILE is set with a non-existing file V6_3_1 V6_3_1rc3
authorribes <ribes>
Tue, 12 Jul 2011 13:49:45 +0000 (13:49 +0000)
committerribes <ribes>
Tue, 12 Jul 2011 13:49:45 +0000 (13:49 +0000)
src/ResourcesManager/ResourcesManager.cxx

index d6627d4e6e3d1994a6a8a8b8901cfe78df5f4996..c4a8cdd147e07a0dabbce6b30614984708d725e8 100644 (file)
@@ -84,13 +84,23 @@ ResourcesManager_cpp::ResourcesManager_cpp() throw(ResourcesException)
   _resourceManagerMap["best"]=&altcycl;
   _resourceManagerMap[""]=&altcycl;
 
+  bool default_catalog_resource = true;
   if (getenv("USER_CATALOG_RESOURCES_FILE") != 0)
   {
+    default_catalog_resource = false;
     std::string user_file("");
     user_file = getenv("USER_CATALOG_RESOURCES_FILE");
-    _path_resources.push_back(user_file);
+    std::ifstream ifile(user_file.c_str(), std::ifstream::in );
+    if (ifile) {
+      // The file exists, and is open for input
+      _path_resources.push_back(user_file);
+    }
+    else {
+      default_catalog_resource = true;
+      RES_INFOS("Warning: USER_CATALOG_RESOURCES_FILE is set and file cannot be found.")
+    }
   }
-  else
+  if (default_catalog_resource)
   {
     std::string default_file("");
     if (getenv("APPLI") != 0)