From: ribes Date: Mon, 19 Mar 2012 10:40:43 +0000 (+0000) Subject: Resolve PAL# 2058 X-Git-Tag: V6_5_0a1~27 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=156205d4772440675ac2cae40e806b8b1ba1e452;p=modules%2Fkernel.git Resolve PAL# 2058 Create a default catalog resources file if USER_CATALOG_RESOURCES_FILE env variable is set on an unexisting file. If we cannot create the file, we use the default catalog resource file --- diff --git a/src/ResourcesManager/ResourcesManager.cxx b/src/ResourcesManager/ResourcesManager.cxx index c4a8cdd14..a5c3cd423 100644 --- a/src/ResourcesManager/ResourcesManager.cxx +++ b/src/ResourcesManager/ResourcesManager.cxx @@ -96,8 +96,26 @@ ResourcesManager_cpp::ResourcesManager_cpp() throw(ResourcesException) _path_resources.push_back(user_file); } else { - default_catalog_resource = true; + default_catalog_resource = false; RES_INFOS("Warning: USER_CATALOG_RESOURCES_FILE is set and file cannot be found.") + RES_INFOS("Warning: That's why we try to create a new one.") + std::ofstream user_catalog_file; + user_catalog_file.open(user_file.c_str()); + if (user_catalog_file.fail()) + { + RES_INFOS("Error: cannot write in the user catalog resouces files"); + RES_INFOS("Error: using default CatalogResources.xml file"); + default_catalog_resource = true; + } + else + { + user_catalog_file << "" << std::endl; + user_catalog_file << "" << std::endl; + user_catalog_file << "" << std::endl; + user_catalog_file << " " << std::endl; + user_catalog_file << "" << std::endl; + user_catalog_file.close(); + } } } if (default_catalog_resource)