mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2024-11-11 16:19:17 +05:00
Enhancement of mechanism of automatic searching of GEOM plugins to catch Import/Export ones too.
This commit is contained in:
parent
63d63ea8af
commit
37e494a62c
@ -19,7 +19,7 @@
|
||||
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
#
|
||||
|
||||
import os, sys
|
||||
import os, sys, string
|
||||
from salome_utils import getTmpDir, generateFileName, uniteFiles
|
||||
from setenv import add_path, get_lib_dir, salome_subdir
|
||||
|
||||
@ -50,6 +50,14 @@ def set_env( args ):
|
||||
# find plugins
|
||||
plugin_list = []
|
||||
resource_path_list = []
|
||||
plugins_dir_var = "GEOM_ENGINE_RESOURCES_DIR"
|
||||
if os.environ.has_key(plugins_dir_var):
|
||||
# reverse the user's paths list, because the used 'add_path' prepends a new path,
|
||||
# but we want to append it: [a, b, c] => [c, b, a]
|
||||
plugins_dirs = os.environ[plugins_dir_var].split(os.pathsep)
|
||||
plugins_dirs.reverse()
|
||||
os.environ[plugins_dir_var] = string.join(plugins_dirs, os.pathsep)
|
||||
pass
|
||||
for env_var in os.environ.keys():
|
||||
value = os.environ[env_var]
|
||||
if env_var[-9:] == "_ROOT_DIR" and value:
|
||||
@ -60,36 +68,58 @@ def set_env( args ):
|
||||
resource_dir = os.path.join(plugin_root,"share",salome_subdir,"resources",plugin.lower())
|
||||
if not os.access( resource_dir, os.F_OK ): continue
|
||||
for resource_file in os.listdir( resource_dir ):
|
||||
if not resource_file.endswith( ".xml") or \
|
||||
resource_file.lower() != plugin.lower() + ".xml":
|
||||
continue
|
||||
# use "name" attribute of "geom-plugin" as name of plugin in a right case
|
||||
from xml.dom.minidom import parse
|
||||
xml_doc = parse( os.path.join( resource_dir, resource_file ))
|
||||
plugin_nodes = xml_doc.getElementsByTagName("geom-plugin")
|
||||
if not plugin_nodes or not plugin_nodes[0].hasAttribute("name"): continue
|
||||
plugin = plugin_nodes[0].getAttribute("name")
|
||||
if plugin in plugin_list: continue
|
||||
if resource_file.endswith( ".xml") and \
|
||||
resource_file.lower() == plugin.lower() + ".xml":
|
||||
# use "name" attribute of "geom-plugin" as name of plugin in a right case
|
||||
from xml.dom.minidom import parse
|
||||
try:
|
||||
xml_doc = parse( os.path.join( resource_dir, resource_file ))
|
||||
plugin_nodes = xml_doc.getElementsByTagName("geom-plugin")
|
||||
except:
|
||||
continue
|
||||
if not plugin_nodes or not plugin_nodes[0].hasAttribute("name"): continue
|
||||
plugin = plugin_nodes[0].getAttribute("name")
|
||||
if plugin in plugin_list: continue
|
||||
|
||||
# add paths of plugin
|
||||
plugin_list.append(plugin)
|
||||
if not os.environ.has_key("SALOME_"+plugin+"Resources"):
|
||||
resource_path = os.path.join(plugin_root,"share",salome_subdir,"resources",plugin.lower())
|
||||
os.environ["SALOME_"+plugin+"Resources"] = resource_path
|
||||
resource_path_list.append( resource_path )
|
||||
add_path(os.path.join(plugin_root,get_lib_dir(),python_version, "site-packages",salome_subdir), "PYTHONPATH")
|
||||
add_path(os.path.join(plugin_root,get_lib_dir(),salome_subdir), "PYTHONPATH")
|
||||
# add paths of plugin
|
||||
plugin_list.append(plugin)
|
||||
if not os.environ.has_key("SALOME_"+plugin+"Resources"):
|
||||
resource_path = os.path.join(plugin_root,"share",salome_subdir,"resources",plugin.lower())
|
||||
os.environ["SALOME_"+plugin+"Resources"] = resource_path
|
||||
resource_path_list.append( resource_path )
|
||||
add_path(os.path.join(plugin_root,get_lib_dir(),python_version, "site-packages",salome_subdir), "PYTHONPATH")
|
||||
add_path(os.path.join(plugin_root,get_lib_dir(),salome_subdir), "PYTHONPATH")
|
||||
|
||||
if sys.platform == "win32":
|
||||
add_path(os.path.join(plugin_root,get_lib_dir(),salome_subdir), "PATH")
|
||||
add_path(os.path.join(plugin_root,"bin",salome_subdir), "PYTHONPATH")
|
||||
else:
|
||||
add_path(os.path.join(plugin_root,get_lib_dir(),salome_subdir), "LD_LIBRARY_PATH")
|
||||
add_path(os.path.join(plugin_root,"bin",salome_subdir), "PYTHONPATH")
|
||||
add_path(os.path.join(plugin_root,"bin",salome_subdir), "PATH")
|
||||
if sys.platform == "win32":
|
||||
add_path(os.path.join(plugin_root,get_lib_dir(),salome_subdir), "PATH")
|
||||
add_path(os.path.join(plugin_root,"bin",salome_subdir), "PYTHONPATH")
|
||||
else:
|
||||
add_path(os.path.join(plugin_root,get_lib_dir(),salome_subdir), "LD_LIBRARY_PATH")
|
||||
add_path(os.path.join(plugin_root,"bin",salome_subdir), "PYTHONPATH")
|
||||
add_path(os.path.join(plugin_root,"bin",salome_subdir), "PATH")
|
||||
pass
|
||||
pass
|
||||
pass
|
||||
break
|
||||
elif resource_file == "ImportExport" and plugin.upper() != "GEOM":
|
||||
# add 'ImportExport' plugin file path into variable
|
||||
add_path(resource_dir, plugins_dir_var)
|
||||
# add plugin's library path into environment
|
||||
if sys.platform == "win32":
|
||||
add_path(os.path.join(plugin_root,get_lib_dir(),salome_subdir), "PATH")
|
||||
else:
|
||||
add_path(os.path.join(plugin_root,get_lib_dir(),salome_subdir), "LD_LIBRARY_PATH")
|
||||
pass
|
||||
pass
|
||||
pass
|
||||
plugin_list.append("GEOMActions")
|
||||
os.environ["GEOM_PluginsList"] = ":".join(plugin_list)
|
||||
os.environ["SalomeAppConfig"] = os.environ["SalomeAppConfig"] + psep + psep.join(resource_path_list)
|
||||
|
||||
if os.environ.has_key(plugins_dir_var):
|
||||
# reverse back the plugin paths:
|
||||
# [f, e, d, c, b, a] => [a, b, c, d, e, f]
|
||||
plugins_dirs = os.environ[plugins_dir_var].split(os.pathsep)
|
||||
plugins_dirs.reverse()
|
||||
os.environ[plugins_dir_var] = string.join(plugins_dirs, os.pathsep)
|
||||
pass
|
||||
pass
|
||||
|
@ -1,5 +1,5 @@
|
||||
Import: BREP|IGES|STEP|STL|ACIS
|
||||
Export: BREP|IGES|IGES_5_3|STEP|STL_Bin|STL_ASCII|ACIS|VTK
|
||||
Import: BREP|IGES|STEP|STL
|
||||
Export: BREP|IGES|IGES_5_3|STEP|STL_Bin|STL_ASCII|VTK
|
||||
|
||||
BREP.Import: BREPImport
|
||||
BREP.Export: BREPExport
|
||||
@ -26,9 +26,5 @@ STL_Bin.Pattern: STL Binary Files ( *.stl )
|
||||
STL_ASCII.Export: STLExport
|
||||
STL_ASCII.Pattern: STL ASCII Files ( *.stl )
|
||||
|
||||
ACIS.Import: ACISImport
|
||||
ACIS.Export: ACISExport
|
||||
ACIS.Pattern: ACIS Files ( *.sat )
|
||||
|
||||
VTK.Export: VTKExport
|
||||
VTK.Pattern: VTK Files ( *.vtk )
|
||||
|
319
src/GEOMImpl/GEOMImpl_IInsertOperations.cxx
Normal file → Executable file
319
src/GEOMImpl/GEOMImpl_IInsertOperations.cxx
Normal file → Executable file
@ -392,58 +392,48 @@ Standard_Boolean GEOMImpl_IInsertOperations::ImportTranslators
|
||||
|
||||
if (!InitResMgr()) return Standard_False;
|
||||
|
||||
// Read Import formats list from install directory
|
||||
if (myResMgr->Find("Import")) {
|
||||
TCollection_AsciiString aFormats (myResMgr->Value("Import"));
|
||||
TCollection_AsciiString aToken = aFormats.Token("| \t", 1);
|
||||
int i = 1;
|
||||
for (; !aToken.IsEmpty(); aToken = aFormats.Token("| \t", ++i)) {
|
||||
theFormats->Append(aToken);
|
||||
// Read Import formats from directories
|
||||
Handle(Resource_Manager) aResMgr;
|
||||
Handle(TColStd_HSequenceOfAsciiString) aFormatsToAdd;
|
||||
for(int index = 0; index < myResMgrList.size(); index++) {
|
||||
int anOldLen = theFormats->Length();
|
||||
aResMgr = myResMgrList.at(index);
|
||||
if (aResMgr->Find("Import")) {
|
||||
TCollection_AsciiString aFormats (aResMgr->Value("Import"));
|
||||
TCollection_AsciiString aToken = aFormats.Token("| \t", 1);
|
||||
for (int i = 1; !aToken.IsEmpty(); aToken = aFormats.Token("| \t", ++i)) {
|
||||
int aLenFormats = theFormats->Length();
|
||||
bool isFound = false;
|
||||
for(int aInd=1;aInd<=aLenFormats;aInd++){
|
||||
if( theFormats->Value(aInd) == aToken ){
|
||||
isFound = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!isFound)
|
||||
theFormats->Append(aToken);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Read Import formats from user directory
|
||||
if (myResMgrUser->Find("Import")) {
|
||||
TCollection_AsciiString aFormats (myResMgrUser->Value("Import"));
|
||||
TCollection_AsciiString aToken = aFormats.Token("| \t", 1);
|
||||
int i = 1;
|
||||
for (; !aToken.IsEmpty(); aToken = aFormats.Token("| \t", ++i)) {
|
||||
int aLenFormats = theFormats->Length();
|
||||
bool isFound = false;
|
||||
for(int aInd=1;aInd<=aLenFormats;aInd++){
|
||||
if( theFormats->Value(aInd) == aToken){
|
||||
isFound = true;
|
||||
break;
|
||||
// Read Patterns for each supported format
|
||||
for (int j = anOldLen+1; j <= theFormats->Length(); j++) {
|
||||
TCollection_AsciiString aKey, aPattern;
|
||||
aKey = theFormats->Value(j) + ".ImportPattern";
|
||||
if (aResMgr->Find(aKey.ToCString()))
|
||||
aPattern = aResMgr->Value(aKey.ToCString());
|
||||
else {
|
||||
aKey = theFormats->Value(j) + ".Pattern";
|
||||
if (aResMgr->Find(aKey.ToCString()))
|
||||
aPattern = aResMgr->Value(aKey.ToCString());
|
||||
else {
|
||||
aPattern = theFormats->Value(j);
|
||||
aPattern += " Files ( *.* )";
|
||||
}
|
||||
}
|
||||
if(!isFound)
|
||||
theFormats->Append(aToken);
|
||||
thePatterns->Append(aPattern);
|
||||
}
|
||||
}
|
||||
|
||||
// Read Patterns for each supported format
|
||||
int j = 1, len = theFormats->Length();
|
||||
for (; j <= len; j++) {
|
||||
TCollection_AsciiString aKey, aPattern;
|
||||
aKey = theFormats->Value(j) + ".ImportPattern";
|
||||
if (myResMgr->Find(aKey.ToCString()))
|
||||
aPattern = myResMgr->Value(aKey.ToCString());
|
||||
else if(myResMgrUser->Find(aKey.ToCString()))
|
||||
aPattern = myResMgrUser->Value(aKey.ToCString());
|
||||
else {
|
||||
aKey = theFormats->Value(j) + ".Pattern";
|
||||
if (myResMgr->Find(aKey.ToCString()))
|
||||
aPattern = myResMgr->Value(aKey.ToCString());
|
||||
else if(myResMgrUser->Find(aKey.ToCString()))
|
||||
aPattern = myResMgrUser->Value(aKey.ToCString());
|
||||
else {
|
||||
aPattern = theFormats->Value(j);
|
||||
aPattern += " Files ( *.* )";
|
||||
}
|
||||
}
|
||||
thePatterns->Append(aPattern);
|
||||
}
|
||||
|
||||
return (!theFormats->IsEmpty());
|
||||
}
|
||||
|
||||
@ -468,58 +458,47 @@ Standard_Boolean GEOMImpl_IInsertOperations::ExportTranslators
|
||||
|
||||
if (!InitResMgr()) return Standard_False;
|
||||
|
||||
// Read Export formats list from install directory
|
||||
if (myResMgr->Find("Export")) {
|
||||
TCollection_AsciiString aFormats (myResMgr->Value("Export"));
|
||||
TCollection_AsciiString aToken = aFormats.Token("| \t", 1);
|
||||
int i = 1;
|
||||
for (; !aToken.IsEmpty(); aToken = aFormats.Token("| \t", ++i)) {
|
||||
theFormats->Append(aToken);
|
||||
// Read Export formats list from directories
|
||||
Handle(Resource_Manager) aResMgr;
|
||||
for(int index=0; index < myResMgrList.size(); index++) {
|
||||
int anOldLen = theFormats->Length();
|
||||
aResMgr = myResMgrList.at(index);
|
||||
if (aResMgr->Find("Export")) {
|
||||
TCollection_AsciiString aFormats (aResMgr->Value("Export"));
|
||||
TCollection_AsciiString aToken = aFormats.Token("| \t", 1);
|
||||
for (int i = 1; !aToken.IsEmpty(); aToken = aFormats.Token("| \t", ++i)) {
|
||||
int aLenFormats = theFormats->Length();
|
||||
bool isFound = false;
|
||||
for(int aInd=1;aInd<=aLenFormats;aInd++){
|
||||
if( theFormats->Value(aInd) == aToken){
|
||||
isFound = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!isFound)
|
||||
theFormats->Append(aToken);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Read Export formats list from user directory
|
||||
if (myResMgrUser->Find("Export")) {
|
||||
TCollection_AsciiString aFormats (myResMgrUser->Value("Export"));
|
||||
TCollection_AsciiString aToken = aFormats.Token("| \t", 1);
|
||||
int i = 1;
|
||||
for (; !aToken.IsEmpty(); aToken = aFormats.Token("| \t", ++i)) {
|
||||
int aLenFormats = theFormats->Length();
|
||||
bool isFound = false;
|
||||
for(int aInd=1;aInd<=aLenFormats;aInd++){
|
||||
if( theFormats->Value(aInd) == aToken){
|
||||
isFound = true;
|
||||
break;
|
||||
// Read Patterns for each supported format
|
||||
for (int j = anOldLen+1; j <= theFormats->Length(); j++) {
|
||||
TCollection_AsciiString aKey, aPattern;
|
||||
aKey = theFormats->Value(j) + ".ExportPattern";
|
||||
if (aResMgr->Find(aKey.ToCString()))
|
||||
aPattern = aResMgr->Value(aKey.ToCString());
|
||||
else {
|
||||
aKey = theFormats->Value(j) + ".Pattern";
|
||||
if (aResMgr->Find(aKey.ToCString()))
|
||||
aPattern = aResMgr->Value(aKey.ToCString());
|
||||
else {
|
||||
aPattern = theFormats->Value(j);
|
||||
aPattern += " Files ( *.* )";
|
||||
}
|
||||
}
|
||||
if(!isFound)
|
||||
theFormats->Append(aToken);
|
||||
thePatterns->Append(aPattern);
|
||||
}
|
||||
}
|
||||
|
||||
// Read Patterns for each supported format
|
||||
int j = 1, len = theFormats->Length();
|
||||
for (; j <= len; j++) {
|
||||
TCollection_AsciiString aKey, aPattern;
|
||||
aKey = theFormats->Value(j) + ".ExportPattern";
|
||||
if (myResMgr->Find(aKey.ToCString()))
|
||||
aPattern = myResMgr->Value(aKey.ToCString());
|
||||
else if (myResMgrUser->Find(aKey.ToCString()))
|
||||
aPattern = myResMgrUser->Value(aKey.ToCString());
|
||||
else {
|
||||
aKey = theFormats->Value(j) + ".Pattern";
|
||||
if (myResMgr->Find(aKey.ToCString()))
|
||||
aPattern = myResMgr->Value(aKey.ToCString());
|
||||
else if (myResMgrUser->Find(aKey.ToCString()))
|
||||
aPattern = myResMgrUser->Value(aKey.ToCString());
|
||||
else {
|
||||
aPattern = theFormats->Value(j);
|
||||
aPattern += " Files ( *.* )";
|
||||
}
|
||||
}
|
||||
thePatterns->Append(aPattern);
|
||||
}
|
||||
|
||||
return (!theFormats->IsEmpty());
|
||||
}
|
||||
|
||||
@ -541,48 +520,29 @@ Standard_Boolean GEOMImpl_IInsertOperations::IsSupported
|
||||
if (isImport) aMode = "Import";
|
||||
else aMode = "Export";
|
||||
|
||||
// Read supported formats for the certain mode from install directory
|
||||
if (myResMgr->Find(aMode.ToCString())) {
|
||||
TCollection_AsciiString aFormats (myResMgr->Value(aMode.ToCString()));
|
||||
if (aFormats.Search(theFormat) > -1) {
|
||||
// Read library name for the supported format
|
||||
TCollection_AsciiString aKey (theFormat);
|
||||
aKey += ".";
|
||||
aKey += aMode;
|
||||
if (myResMgr->Find(aKey.ToCString())) {
|
||||
TCollection_AsciiString aLibName (myResMgr->Value(aKey.ToCString()));
|
||||
#ifndef WIN32
|
||||
if ( aLibName.Length() > 3 && aLibName.SubString(1,3) != "lib" )
|
||||
aLibName.Prepend("lib");
|
||||
aLibName += ".so";
|
||||
#else
|
||||
aLibName += ".dll";
|
||||
#endif
|
||||
theLibName = new TCollection_HAsciiString (aLibName);
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Read supported formats for the certain mode from user directory
|
||||
if (myResMgrUser->Find(aMode.ToCString())) {
|
||||
TCollection_AsciiString aFormats (myResMgrUser->Value(aMode.ToCString()));
|
||||
if (aFormats.Search(theFormat) > -1) {
|
||||
// Read library name for the supported format
|
||||
TCollection_AsciiString aKey (theFormat);
|
||||
aKey += ".";
|
||||
aKey += aMode;
|
||||
if (myResMgrUser->Find(aKey.ToCString())) {
|
||||
TCollection_AsciiString aLibName (myResMgrUser->Value(aKey.ToCString()));
|
||||
#ifndef WIN32
|
||||
if ( aLibName.Length() > 3 && aLibName.SubString(1,3) != "lib" )
|
||||
aLibName.Prepend("lib");
|
||||
aLibName += ".so";
|
||||
#else
|
||||
aLibName += ".dll";
|
||||
#endif
|
||||
theLibName = new TCollection_HAsciiString (aLibName);
|
||||
return Standard_True;
|
||||
Handle(Resource_Manager) aResMgr;
|
||||
for(int index=0; index < myResMgrList.size(); index++) {
|
||||
aResMgr = myResMgrList.at(index);
|
||||
if (aResMgr->Find(aMode.ToCString())) {
|
||||
TCollection_AsciiString aFormats (aResMgr->Value(aMode.ToCString()));
|
||||
if (aFormats.Search(theFormat) > -1) {
|
||||
// Read library name for the supported format
|
||||
TCollection_AsciiString aKey (theFormat);
|
||||
aKey += ".";
|
||||
aKey += aMode;
|
||||
if (aResMgr->Find(aKey.ToCString())) {
|
||||
TCollection_AsciiString aLibName (aResMgr->Value(aKey.ToCString()));
|
||||
#ifndef WIN32
|
||||
if ( aLibName.Length() > 3 && aLibName.SubString(1,3) != "lib" )
|
||||
aLibName.Prepend("lib");
|
||||
aLibName += ".so";
|
||||
#else
|
||||
aLibName += ".dll";
|
||||
#endif
|
||||
theLibName = new TCollection_HAsciiString (aLibName);
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -597,67 +557,56 @@ Standard_Boolean GEOMImpl_IInsertOperations::IsSupported
|
||||
//=============================================================================
|
||||
Standard_Boolean GEOMImpl_IInsertOperations::InitResMgr()
|
||||
{
|
||||
bool isResourceFound = false;
|
||||
bool isResourceFoundUser = false;
|
||||
TCollection_AsciiString aUserResDir,aResDir;
|
||||
bool isResourceFound = false;
|
||||
TCollection_AsciiString aNull;
|
||||
|
||||
if (myResMgr.IsNull()) {
|
||||
// Initialize the Resource Manager
|
||||
TCollection_AsciiString aNull;
|
||||
aResDir = TCollection_AsciiString(getenv("GEOM_ROOT_DIR"));
|
||||
myResMgrList.clear();
|
||||
|
||||
// Initialize the GEOM Resource Manager
|
||||
TCollection_AsciiString aResDir = TCollection_AsciiString(getenv("GEOM_ROOT_DIR"));
|
||||
#ifdef WIN32
|
||||
aResDir += "\\share\\salome\\resources\\geom";
|
||||
aResDir += "\\share\\salome\\resources\\geom";
|
||||
#else
|
||||
aResDir += "/share/salome/resources/geom";
|
||||
aResDir += "/share/salome/resources/geom";
|
||||
#endif
|
||||
|
||||
myResMgr = new Resource_Manager ("ImportExport", aResDir, aNull, Standard_False);
|
||||
|
||||
Handle(Resource_Manager) aGeomResMgr = new Resource_Manager ("ImportExport", aResDir, aNull, Standard_False);
|
||||
if ( aGeomResMgr->Find("Import") || aGeomResMgr->Find("Export") ) {
|
||||
myResMgrList.push_back( aGeomResMgr );
|
||||
isResourceFound = true;
|
||||
if (!myResMgr->Find("Import") && !myResMgr->Find("Export")) {
|
||||
// instead of complains in Resource_Manager
|
||||
isResourceFound = false;
|
||||
INFOS("No valid file \"ImportExport\" found in " << aResDir.ToCString());
|
||||
}
|
||||
} else
|
||||
isResourceFound = true;
|
||||
|
||||
if (myResMgrUser.IsNull()) {
|
||||
char * dir = getenv("GEOM_ENGINE_RESOURCES_DIR");
|
||||
TCollection_AsciiString aNull;
|
||||
if ( dir )
|
||||
{
|
||||
aUserResDir = dir;
|
||||
}
|
||||
else
|
||||
{
|
||||
aUserResDir = getenv("HOME");
|
||||
#ifdef WIN32
|
||||
aUserResDir += "\\.salome\\resources";
|
||||
#else
|
||||
aUserResDir += "/.salome/resources";
|
||||
#endif
|
||||
}
|
||||
|
||||
myResMgrUser = new Resource_Manager ("ImportExport", aNull, aUserResDir, Standard_False);
|
||||
|
||||
isResourceFoundUser = true;
|
||||
|
||||
if (!myResMgrUser->Find("Import") && !myResMgrUser->Find("Export")) {
|
||||
// instead of complains in Resource_Manager
|
||||
isResourceFoundUser = false;
|
||||
}
|
||||
|
||||
} else
|
||||
isResourceFoundUser = true;
|
||||
|
||||
if(!isResourceFound && !isResourceFoundUser){
|
||||
INFOS("No valid file \"ImportExport\" found in " << aResDir.ToCString());
|
||||
INFOS("No valid file \"ImportExport\" found in " << aUserResDir.ToCString() );
|
||||
}
|
||||
|
||||
return ( myResMgr->Find("Import") || myResMgr->Find("Export") ||
|
||||
myResMgrUser->Find("Import") || myResMgrUser->Find("Export"));
|
||||
// Initialize the user's Resource Manager
|
||||
TCollection_AsciiString aResDirsStr = getenv("GEOM_ENGINE_RESOURCES_DIR");
|
||||
if ( !aResDirsStr.IsEmpty() )
|
||||
{
|
||||
std::string aSep = ":";
|
||||
#ifdef WIN32
|
||||
aSep = ";";
|
||||
#endif
|
||||
aResDir = aResDirsStr.Token(aSep.c_str(), 1);
|
||||
for (int i = 1; !aResDir.IsEmpty(); aResDir = aResDirsStr.Token(aSep.c_str(), ++i)) {
|
||||
Handle(Resource_Manager) anUserResMgr = new Resource_Manager ("ImportExport", aNull, aResDir, Standard_False);
|
||||
if (anUserResMgr->Find("Import") || anUserResMgr->Find("Export")) {
|
||||
myResMgrList.push_back( anUserResMgr );
|
||||
isResourceFound = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
aResDir = getenv("HOME");
|
||||
#ifdef WIN32
|
||||
aResDir += "\\.config\\salome";
|
||||
#else
|
||||
aResDir += "/.config/salome";
|
||||
#endif
|
||||
Handle(Resource_Manager) anUserResMgr = new Resource_Manager ("ImportExport", aNull, aResDir, Standard_False);
|
||||
if (anUserResMgr->Find("Import") || anUserResMgr->Find("Export")) {
|
||||
myResMgrList.push_back( anUserResMgr );
|
||||
isResourceFound = true;
|
||||
}
|
||||
}
|
||||
return isResourceFound;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
@ -143,8 +143,7 @@ class GEOMImpl_IInsertOperations : public GEOM_IOperations {
|
||||
const NCollection_List<TopoDS_Shape> &theShapes);
|
||||
|
||||
private:
|
||||
Handle(Resource_Manager) myResMgr;
|
||||
Handle(Resource_Manager) myResMgrUser;
|
||||
std::vector<Handle(Resource_Manager)> myResMgrList;
|
||||
GEOMImpl_IShapesOperations* myShapesOperations;
|
||||
GEOMImpl_IGroupOperations* myGroupOperations;
|
||||
GEOMImpl_IFieldOperations* myFieldOperations;
|
||||
|
Loading…
Reference in New Issue
Block a user