From: apo Date: Fri, 13 Jan 2006 06:28:53 +0000 (+0000) Subject: Adjust to OCC_development_generic_2006 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2FBR2-D5-38-2003;p=modules%2Fkernel.git Adjust to OCC_development_generic_2006 --- diff --git a/bin/runSalome.py b/bin/runSalome.py index 9d0a66971..98ff0a19f 100755 --- a/bin/runSalome.py +++ b/bin/runSalome.py @@ -65,7 +65,7 @@ def get_config(): 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 "*" @@ -155,10 +155,18 @@ def set_env(args, modules_list, modules_root_dir): 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" diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_StudyBuilder.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_StudyBuilder.cxx index 4dcefc7c6..d527211d7 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_StudyBuilder.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_StudyBuilder.cxx @@ -280,7 +280,8 @@ bool SALOMEDSImpl_StudyBuilder::RemoveObjectWithChildren(const Handle(SALOMEDSIm * 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 = ""; @@ -291,7 +292,7 @@ bool SALOMEDSImpl_StudyBuilder::LoadWith(const Handle(SALOMEDSImpl_SComponent)& 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; @@ -313,24 +314,22 @@ bool SALOMEDSImpl_StudyBuilder::LoadWith(const Handle(SALOMEDSImpl_SComponent)& } 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 { @@ -340,7 +339,7 @@ bool SALOMEDSImpl_StudyBuilder::LoadWith(const Handle(SALOMEDSImpl_SComponent)& hdf_group->OpenOnDisk(); HDFgroup *hdf_sco_group = new HDFgroup(scoid.ToCString(), hdf_group); hdf_sco_group->OpenOnDisk(); - + unsigned char* aStreamFile = NULL; int aStreamSize = 0; @@ -353,16 +352,17 @@ bool SALOMEDSImpl_StudyBuilder::LoadWith(const Handle(SALOMEDSImpl_SComponent)& 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]; @@ -372,7 +372,7 @@ bool SALOMEDSImpl_StudyBuilder::LoadWith(const Handle(SALOMEDSImpl_SComponent)& 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'); @@ -385,14 +385,14 @@ bool SALOMEDSImpl_StudyBuilder::LoadWith(const Handle(SALOMEDSImpl_SComponent)& _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(); @@ -403,10 +403,9 @@ bool SALOMEDSImpl_StudyBuilder::LoadWith(const Handle(SALOMEDSImpl_SComponent)& 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; @@ -416,7 +415,6 @@ bool SALOMEDSImpl_StudyBuilder::LoadWith(const Handle(SALOMEDSImpl_SComponent)& 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";