mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2024-12-27 01:40:34 +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
|
# 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 salome_utils import getTmpDir, generateFileName, uniteFiles
|
||||||
from setenv import add_path, get_lib_dir, salome_subdir
|
from setenv import add_path, get_lib_dir, salome_subdir
|
||||||
|
|
||||||
@ -50,6 +50,14 @@ def set_env( args ):
|
|||||||
# find plugins
|
# find plugins
|
||||||
plugin_list = []
|
plugin_list = []
|
||||||
resource_path_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():
|
for env_var in os.environ.keys():
|
||||||
value = os.environ[env_var]
|
value = os.environ[env_var]
|
||||||
if env_var[-9:] == "_ROOT_DIR" and value:
|
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())
|
resource_dir = os.path.join(plugin_root,"share",salome_subdir,"resources",plugin.lower())
|
||||||
if not os.access( resource_dir, os.F_OK ): continue
|
if not os.access( resource_dir, os.F_OK ): continue
|
||||||
for resource_file in os.listdir( resource_dir ):
|
for resource_file in os.listdir( resource_dir ):
|
||||||
if not resource_file.endswith( ".xml") or \
|
if resource_file.endswith( ".xml") and \
|
||||||
resource_file.lower() != plugin.lower() + ".xml":
|
resource_file.lower() == plugin.lower() + ".xml":
|
||||||
continue
|
# use "name" attribute of "geom-plugin" as name of plugin in a right case
|
||||||
# use "name" attribute of "geom-plugin" as name of plugin in a right case
|
from xml.dom.minidom import parse
|
||||||
from xml.dom.minidom import parse
|
try:
|
||||||
xml_doc = parse( os.path.join( resource_dir, resource_file ))
|
xml_doc = parse( os.path.join( resource_dir, resource_file ))
|
||||||
plugin_nodes = xml_doc.getElementsByTagName("geom-plugin")
|
plugin_nodes = xml_doc.getElementsByTagName("geom-plugin")
|
||||||
if not plugin_nodes or not plugin_nodes[0].hasAttribute("name"): continue
|
except:
|
||||||
plugin = plugin_nodes[0].getAttribute("name")
|
continue
|
||||||
if plugin in plugin_list: 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
|
# add paths of plugin
|
||||||
plugin_list.append(plugin)
|
plugin_list.append(plugin)
|
||||||
if not os.environ.has_key("SALOME_"+plugin+"Resources"):
|
if not os.environ.has_key("SALOME_"+plugin+"Resources"):
|
||||||
resource_path = os.path.join(plugin_root,"share",salome_subdir,"resources",plugin.lower())
|
resource_path = os.path.join(plugin_root,"share",salome_subdir,"resources",plugin.lower())
|
||||||
os.environ["SALOME_"+plugin+"Resources"] = resource_path
|
os.environ["SALOME_"+plugin+"Resources"] = resource_path
|
||||||
resource_path_list.append( 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(),python_version, "site-packages",salome_subdir), "PYTHONPATH")
|
||||||
add_path(os.path.join(plugin_root,get_lib_dir(),salome_subdir), "PYTHONPATH")
|
add_path(os.path.join(plugin_root,get_lib_dir(),salome_subdir), "PYTHONPATH")
|
||||||
|
|
||||||
if sys.platform == "win32":
|
if sys.platform == "win32":
|
||||||
add_path(os.path.join(plugin_root,get_lib_dir(),salome_subdir), "PATH")
|
add_path(os.path.join(plugin_root,get_lib_dir(),salome_subdir), "PATH")
|
||||||
add_path(os.path.join(plugin_root,"bin",salome_subdir), "PYTHONPATH")
|
add_path(os.path.join(plugin_root,"bin",salome_subdir), "PYTHONPATH")
|
||||||
else:
|
else:
|
||||||
add_path(os.path.join(plugin_root,get_lib_dir(),salome_subdir), "LD_LIBRARY_PATH")
|
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), "PYTHONPATH")
|
||||||
add_path(os.path.join(plugin_root,"bin",salome_subdir), "PATH")
|
add_path(os.path.join(plugin_root,"bin",salome_subdir), "PATH")
|
||||||
|
pass
|
||||||
pass
|
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")
|
plugin_list.append("GEOMActions")
|
||||||
os.environ["GEOM_PluginsList"] = ":".join(plugin_list)
|
os.environ["GEOM_PluginsList"] = ":".join(plugin_list)
|
||||||
os.environ["SalomeAppConfig"] = os.environ["SalomeAppConfig"] + psep + psep.join(resource_path_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
|
Import: BREP|IGES|STEP|STL
|
||||||
Export: BREP|IGES|IGES_5_3|STEP|STL_Bin|STL_ASCII|ACIS|VTK
|
Export: BREP|IGES|IGES_5_3|STEP|STL_Bin|STL_ASCII|VTK
|
||||||
|
|
||||||
BREP.Import: BREPImport
|
BREP.Import: BREPImport
|
||||||
BREP.Export: BREPExport
|
BREP.Export: BREPExport
|
||||||
@ -26,9 +26,5 @@ STL_Bin.Pattern: STL Binary Files ( *.stl )
|
|||||||
STL_ASCII.Export: STLExport
|
STL_ASCII.Export: STLExport
|
||||||
STL_ASCII.Pattern: STL ASCII Files ( *.stl )
|
STL_ASCII.Pattern: STL ASCII Files ( *.stl )
|
||||||
|
|
||||||
ACIS.Import: ACISImport
|
|
||||||
ACIS.Export: ACISExport
|
|
||||||
ACIS.Pattern: ACIS Files ( *.sat )
|
|
||||||
|
|
||||||
VTK.Export: VTKExport
|
VTK.Export: VTKExport
|
||||||
VTK.Pattern: VTK Files ( *.vtk )
|
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;
|
if (!InitResMgr()) return Standard_False;
|
||||||
|
|
||||||
// Read Import formats list from install directory
|
// Read Import formats from directories
|
||||||
if (myResMgr->Find("Import")) {
|
Handle(Resource_Manager) aResMgr;
|
||||||
TCollection_AsciiString aFormats (myResMgr->Value("Import"));
|
Handle(TColStd_HSequenceOfAsciiString) aFormatsToAdd;
|
||||||
TCollection_AsciiString aToken = aFormats.Token("| \t", 1);
|
for(int index = 0; index < myResMgrList.size(); index++) {
|
||||||
int i = 1;
|
int anOldLen = theFormats->Length();
|
||||||
for (; !aToken.IsEmpty(); aToken = aFormats.Token("| \t", ++i)) {
|
aResMgr = myResMgrList.at(index);
|
||||||
theFormats->Append(aToken);
|
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
|
// Read Patterns for each supported format
|
||||||
if (myResMgrUser->Find("Import")) {
|
for (int j = anOldLen+1; j <= theFormats->Length(); j++) {
|
||||||
TCollection_AsciiString aFormats (myResMgrUser->Value("Import"));
|
TCollection_AsciiString aKey, aPattern;
|
||||||
TCollection_AsciiString aToken = aFormats.Token("| \t", 1);
|
aKey = theFormats->Value(j) + ".ImportPattern";
|
||||||
int i = 1;
|
if (aResMgr->Find(aKey.ToCString()))
|
||||||
for (; !aToken.IsEmpty(); aToken = aFormats.Token("| \t", ++i)) {
|
aPattern = aResMgr->Value(aKey.ToCString());
|
||||||
int aLenFormats = theFormats->Length();
|
else {
|
||||||
bool isFound = false;
|
aKey = theFormats->Value(j) + ".Pattern";
|
||||||
for(int aInd=1;aInd<=aLenFormats;aInd++){
|
if (aResMgr->Find(aKey.ToCString()))
|
||||||
if( theFormats->Value(aInd) == aToken){
|
aPattern = aResMgr->Value(aKey.ToCString());
|
||||||
isFound = true;
|
else {
|
||||||
break;
|
aPattern = theFormats->Value(j);
|
||||||
|
aPattern += " Files ( *.* )";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!isFound)
|
thePatterns->Append(aPattern);
|
||||||
theFormats->Append(aToken);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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());
|
return (!theFormats->IsEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -468,58 +458,47 @@ Standard_Boolean GEOMImpl_IInsertOperations::ExportTranslators
|
|||||||
|
|
||||||
if (!InitResMgr()) return Standard_False;
|
if (!InitResMgr()) return Standard_False;
|
||||||
|
|
||||||
// Read Export formats list from install directory
|
// Read Export formats list from directories
|
||||||
if (myResMgr->Find("Export")) {
|
Handle(Resource_Manager) aResMgr;
|
||||||
TCollection_AsciiString aFormats (myResMgr->Value("Export"));
|
for(int index=0; index < myResMgrList.size(); index++) {
|
||||||
TCollection_AsciiString aToken = aFormats.Token("| \t", 1);
|
int anOldLen = theFormats->Length();
|
||||||
int i = 1;
|
aResMgr = myResMgrList.at(index);
|
||||||
for (; !aToken.IsEmpty(); aToken = aFormats.Token("| \t", ++i)) {
|
if (aResMgr->Find("Export")) {
|
||||||
theFormats->Append(aToken);
|
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
|
// Read Patterns for each supported format
|
||||||
if (myResMgrUser->Find("Export")) {
|
for (int j = anOldLen+1; j <= theFormats->Length(); j++) {
|
||||||
TCollection_AsciiString aFormats (myResMgrUser->Value("Export"));
|
TCollection_AsciiString aKey, aPattern;
|
||||||
TCollection_AsciiString aToken = aFormats.Token("| \t", 1);
|
aKey = theFormats->Value(j) + ".ExportPattern";
|
||||||
int i = 1;
|
if (aResMgr->Find(aKey.ToCString()))
|
||||||
for (; !aToken.IsEmpty(); aToken = aFormats.Token("| \t", ++i)) {
|
aPattern = aResMgr->Value(aKey.ToCString());
|
||||||
int aLenFormats = theFormats->Length();
|
else {
|
||||||
bool isFound = false;
|
aKey = theFormats->Value(j) + ".Pattern";
|
||||||
for(int aInd=1;aInd<=aLenFormats;aInd++){
|
if (aResMgr->Find(aKey.ToCString()))
|
||||||
if( theFormats->Value(aInd) == aToken){
|
aPattern = aResMgr->Value(aKey.ToCString());
|
||||||
isFound = true;
|
else {
|
||||||
break;
|
aPattern = theFormats->Value(j);
|
||||||
|
aPattern += " Files ( *.* )";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!isFound)
|
thePatterns->Append(aPattern);
|
||||||
theFormats->Append(aToken);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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());
|
return (!theFormats->IsEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -541,48 +520,29 @@ Standard_Boolean GEOMImpl_IInsertOperations::IsSupported
|
|||||||
if (isImport) aMode = "Import";
|
if (isImport) aMode = "Import";
|
||||||
else aMode = "Export";
|
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
|
// Read supported formats for the certain mode from user directory
|
||||||
if (myResMgrUser->Find(aMode.ToCString())) {
|
Handle(Resource_Manager) aResMgr;
|
||||||
TCollection_AsciiString aFormats (myResMgrUser->Value(aMode.ToCString()));
|
for(int index=0; index < myResMgrList.size(); index++) {
|
||||||
if (aFormats.Search(theFormat) > -1) {
|
aResMgr = myResMgrList.at(index);
|
||||||
// Read library name for the supported format
|
if (aResMgr->Find(aMode.ToCString())) {
|
||||||
TCollection_AsciiString aKey (theFormat);
|
TCollection_AsciiString aFormats (aResMgr->Value(aMode.ToCString()));
|
||||||
aKey += ".";
|
if (aFormats.Search(theFormat) > -1) {
|
||||||
aKey += aMode;
|
// Read library name for the supported format
|
||||||
if (myResMgrUser->Find(aKey.ToCString())) {
|
TCollection_AsciiString aKey (theFormat);
|
||||||
TCollection_AsciiString aLibName (myResMgrUser->Value(aKey.ToCString()));
|
aKey += ".";
|
||||||
#ifndef WIN32
|
aKey += aMode;
|
||||||
if ( aLibName.Length() > 3 && aLibName.SubString(1,3) != "lib" )
|
if (aResMgr->Find(aKey.ToCString())) {
|
||||||
aLibName.Prepend("lib");
|
TCollection_AsciiString aLibName (aResMgr->Value(aKey.ToCString()));
|
||||||
aLibName += ".so";
|
#ifndef WIN32
|
||||||
#else
|
if ( aLibName.Length() > 3 && aLibName.SubString(1,3) != "lib" )
|
||||||
aLibName += ".dll";
|
aLibName.Prepend("lib");
|
||||||
#endif
|
aLibName += ".so";
|
||||||
theLibName = new TCollection_HAsciiString (aLibName);
|
#else
|
||||||
return Standard_True;
|
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()
|
Standard_Boolean GEOMImpl_IInsertOperations::InitResMgr()
|
||||||
{
|
{
|
||||||
bool isResourceFound = false;
|
bool isResourceFound = false;
|
||||||
bool isResourceFoundUser = false;
|
TCollection_AsciiString aNull;
|
||||||
TCollection_AsciiString aUserResDir,aResDir;
|
|
||||||
|
|
||||||
if (myResMgr.IsNull()) {
|
myResMgrList.clear();
|
||||||
// Initialize the Resource Manager
|
|
||||||
TCollection_AsciiString aNull;
|
// Initialize the GEOM Resource Manager
|
||||||
aResDir = TCollection_AsciiString(getenv("GEOM_ROOT_DIR"));
|
TCollection_AsciiString aResDir = TCollection_AsciiString(getenv("GEOM_ROOT_DIR"));
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
aResDir += "\\share\\salome\\resources\\geom";
|
aResDir += "\\share\\salome\\resources\\geom";
|
||||||
#else
|
#else
|
||||||
aResDir += "/share/salome/resources/geom";
|
aResDir += "/share/salome/resources/geom";
|
||||||
#endif
|
#endif
|
||||||
|
Handle(Resource_Manager) aGeomResMgr = new Resource_Manager ("ImportExport", aResDir, aNull, Standard_False);
|
||||||
myResMgr = new Resource_Manager ("ImportExport", aResDir, aNull, Standard_False);
|
if ( aGeomResMgr->Find("Import") || aGeomResMgr->Find("Export") ) {
|
||||||
|
myResMgrList.push_back( aGeomResMgr );
|
||||||
isResourceFound = true;
|
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") ||
|
// Initialize the user's Resource Manager
|
||||||
myResMgrUser->Find("Import") || myResMgrUser->Find("Export"));
|
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);
|
const NCollection_List<TopoDS_Shape> &theShapes);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Handle(Resource_Manager) myResMgr;
|
std::vector<Handle(Resource_Manager)> myResMgrList;
|
||||||
Handle(Resource_Manager) myResMgrUser;
|
|
||||||
GEOMImpl_IShapesOperations* myShapesOperations;
|
GEOMImpl_IShapesOperations* myShapesOperations;
|
||||||
GEOMImpl_IGroupOperations* myGroupOperations;
|
GEOMImpl_IGroupOperations* myGroupOperations;
|
||||||
GEOMImpl_IFieldOperations* myFieldOperations;
|
GEOMImpl_IFieldOperations* myFieldOperations;
|
||||||
|
Loading…
Reference in New Issue
Block a user