to_remove_list=[]
for module in modules_list :
- module_variable=module.upper()+"_ROOT_DIR"
+ module_variable=module+"_ROOT_DIR"
if not os.environ.has_key(module_variable):
print "*******************************************************"
print "*"
pass
if args.has_key("SMESH_plugins"):
for plugin in args["SMESH_plugins"]:
- if os.environ.has_key(plugin.upper()+"_ROOT_DIR"):
+ plugin_root = ""
+ if os.environ.has_key(plugin+"_ROOT_DIR"):
+ plugin_root = os.environ[plugin+"_ROOT_DIR"]
+ else:
+ # workaround to avoid modifications of existing environment
+ if os.environ.has_key(plugin.upper()+"_ROOT_DIR"):
+ plugin_root = os.environ[plugin.upper()+"_ROOT_DIR"]
+ pass
+ pass
+ if plugin_root != "":
os.environ["SMESH_MeshersList"] \
= os.environ["SMESH_MeshersList"]+":"+plugin
- plugin_root = os.environ[plugin.upper()+"_ROOT_DIR"]
if not os.environ.has_key("SALOME_"+plugin+"Resources"):
os.environ["SALOME_"+plugin+"Resources"] \
= plugin_root+"/share/"+args["appname"]+"/resources"
* Purpose :
*/
//============================================================================
-bool SALOMEDSImpl_StudyBuilder::LoadWith(const Handle(SALOMEDSImpl_SComponent)& anSCO, SALOMEDSImpl_Driver* aDriver)
+bool SALOMEDSImpl_StudyBuilder::LoadWith(const Handle(SALOMEDSImpl_SComponent)& anSCO,
+ SALOMEDSImpl_Driver* aDriver)
{
_errorCode = "";
if (_doc->Main().FindAttribute(SALOMEDSImpl_AttributePersistentRef::GetID(),Att)) {
int aLocked = anSCO->GetStudy()->GetProperties()->IsLocked();
if (aLocked) anSCO->GetStudy()->GetProperties()->SetLocked(false);
-
+
TCollection_ExtendedString Res(Att->Value());
Handle(SALOMEDSImpl_AttributeComment) type;
}
DefineComponentInstance (anSCO, aDriver->GetIOR());
-
+
TCollection_AsciiString aHDFPath(Res);
-
- char* aHDFUrl;
+
+ TCollection_AsciiString aHDFUrl;
bool isASCII = false;
if (HDFascii::isASCII(aHDFPath.ToCString())) {
isASCII = true;
- char* aResultPath = HDFascii::ConvertFromASCIIToHDF(aHDFPath.ToCString());
- aHDFUrl = new char[strlen(aResultPath) + 19];
- sprintf(aHDFUrl, "%shdf_from_ascii.hdf", aResultPath);
- delete(aResultPath);
+ aHDFUrl = HDFascii::ConvertFromASCIIToHDF(aHDFPath.ToCString());
+ aHDFUrl += "hdf_from_ascii.hdf";
} else {
- aHDFUrl = aHDFPath.ToCString();
+ aHDFUrl = aHDFPath;
}
//Open the Study HDF file
- HDFfile *hdf_file = new HDFfile(aHDFUrl);
-
+ HDFfile *hdf_file = new HDFfile(aHDFUrl.ToCString());
+
char aMultifileState[2];
char ASCIIfileState[2];
try {
hdf_group->OpenOnDisk();
HDFgroup *hdf_sco_group = new HDFgroup(scoid.ToCString(), hdf_group);
hdf_sco_group->OpenOnDisk();
-
+
unsigned char* aStreamFile = NULL;
int aStreamSize = 0;
hdf_dataset->ReadFromDisk(aStreamFile);
hdf_dataset->CloseOnDisk();
hdf_dataset = 0;
- } else aStreamFile = NULL;
-
+ } else
+ aStreamFile = NULL;
+
HDFdataset *multifile_hdf_dataset = new HDFdataset("MULTIFILE_STATE", hdf_sco_group);
multifile_hdf_dataset->OpenOnDisk();
multifile_hdf_dataset->ReadFromDisk(aMultifileState);
-
+
HDFdataset *ascii_hdf_dataset = new HDFdataset("ASCII_STATE", hdf_sco_group);
ascii_hdf_dataset->OpenOnDisk();
ascii_hdf_dataset->ReadFromDisk(ASCIIfileState);
-
+
// set path without file name from URL
int aFileNameSize = Res.Length();
char* aDir = new char[aFileNameSize];
aDir[aCounter+1] = 0;
break;
}
-
+
bool aResult = (ASCIIfileState[0]=='A')?
aDriver->LoadASCII(anSCO, aStreamFile, aStreamSize, aDir, aMultifileState[0]=='M'):
aDriver->Load(anSCO, aStreamFile, aStreamSize, aDir, aMultifileState[0]=='M');
_errorCode = "Can't load component";
throw HDFexception("Unable to load component");
}
-
+
if(aDir != NULL) delete []aDir;
multifile_hdf_dataset->CloseOnDisk();
multifile_hdf_dataset = 0;
ascii_hdf_dataset->CloseOnDisk();
ascii_hdf_dataset = 0;
-
+
hdf_sco_group->CloseOnDisk();
hdf_sco_group = 0;
hdf_group->CloseOnDisk();
if (isASCII) {
Handle(TColStd_HSequenceOfAsciiString) aFilesToRemove = new TColStd_HSequenceOfAsciiString;
aFilesToRemove->Append(aHDFUrl);
- SALOMEDSImpl_Tool::RemoveTemporaryFiles(SALOMEDSImpl_Tool::GetDirFromPath(aHDFUrl), aFilesToRemove, true);
+ SALOMEDSImpl_Tool::RemoveTemporaryFiles(SALOMEDSImpl_Tool::GetDirFromPath(aHDFUrl),
+ aFilesToRemove, true);
}
-
- delete aHDFUrl;
}
catch (HDFexception) {
delete hdf_file;
aFilesToRemove->Append(aHDFUrl);
SALOMEDSImpl_Tool::RemoveTemporaryFiles(SALOMEDSImpl_Tool::GetDirFromPath(aHDFUrl), aFilesToRemove, true);
}
- delete aHDFUrl;
if (aLocked) anSCO->GetStudy()->GetProperties()->SetLocked(true);
_errorCode = "No persistent file";