-// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2019 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
default_file += "/";
default_file += getenv("APPLI");
default_file += "/CatalogResources.xml";
- _path_resources.push_back(default_file);
- }
- else
- {
- if(!getenv("KERNEL_ROOT_DIR"))
- throw ResourcesException("you must define KERNEL_ROOT_DIR environment variable!! -> cannot load a CatalogResources.xml");
- default_file = getenv("KERNEL_ROOT_DIR");
- default_file += "/share/salome/resources/kernel/CatalogResources.xml";
- _path_resources.push_back(default_file);
+ std::ifstream ifile(default_file.c_str(), std::ifstream::in );
+ if (ifile) {
+ // The file exists, and is open for input
+ _path_resources.push_back(default_file);
+ default_catalog_resource=false;
+ }
}
}
+ if (default_catalog_resource)
+ {
+ std::string default_file("");
+ if(!getenv("KERNEL_ROOT_DIR"))
+ throw ResourcesException("you must define KERNEL_ROOT_DIR environment variable!! -> cannot load a CatalogResources.xml");
+ default_file = getenv("KERNEL_ROOT_DIR");
+ default_file += "/share/salome/resources/kernel/CatalogResources.xml";
+ _path_resources.push_back(default_file);
+ }
ParseXmlFiles();
RES_MESSAGE("ResourcesManager_cpp constructor end");
resource.Protocol = sh;
resource.Batch = none;
#ifndef WIN32
+ struct stat statbuf;
if (getenv("HOME") != NULL && getenv("APPLI") != NULL)
{
- resource.AppliPath = string(getenv("HOME")) + "/" + getenv("APPLI");
+ if (stat(getenv("APPLI"), &statbuf) ==0 && S_ISREG(statbuf.st_mode))
+ {
+ // if $APPLI is a regular file, we asume it's a salome Launcher file
+ resource.AppliPath = string(getenv("APPLI"));
+ }
+ else
+ {
+ resource.AppliPath = string(getenv("HOME")) + "/" + getenv("APPLI");
+ }
}
string tmpdir = "/tmp";
if (getenv("TMPDIR") != NULL)