From: ribes Date: Tue, 12 Jul 2011 13:49:45 +0000 (+0000) Subject: Fix Bug with USER_CATALOG_RESOURCES_FILE is set with a non-existing file X-Git-Tag: V6_3_1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=7cdc8fbadc08eca6377c9b9bf6c24a342b8cbc96;p=modules%2Fkernel.git Fix Bug with USER_CATALOG_RESOURCES_FILE is set with a non-existing file --- diff --git a/src/ResourcesManager/ResourcesManager.cxx b/src/ResourcesManager/ResourcesManager.cxx index d6627d4e6..c4a8cdd14 100644 --- a/src/ResourcesManager/ResourcesManager.cxx +++ b/src/ResourcesManager/ResourcesManager.cxx @@ -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)