]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
Adjust to OCC_development_generic_2006 BR2-D5-38-2003
authorapo <apo@opencascade.com>
Fri, 13 Jan 2006 06:28:53 +0000 (06:28 +0000)
committerapo <apo@opencascade.com>
Fri, 13 Jan 2006 06:28:53 +0000 (06:28 +0000)
bin/runSalome.py
src/SALOMEDSImpl/SALOMEDSImpl_StudyBuilder.cxx

index 9d0a669711ce120fc1f792b9b2672313730f2ede..98ff0a19fe5369b9677d5d09d3f29ede95ef21a4 100755 (executable)
@@ -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"
index 4dcefc7c6210cef3bc3be65d587a35ce4a3f2d79..d527211d7549c39b74c04550ff0ae4fe2cd6d2f2 100644 (file)
@@ -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";