Salome HOME
bos #19060 [CEA] Fatal error no persistant file when loading SMESH
[modules/geom.git] / src / GEOM_I / GEOM_Gen_i.cc
index 0f5af1a72231260f39b1dc687042649b5ae955de..800f9ec8f9518e9e1ef44a25ae0fd70955988201 100644 (file)
@@ -604,12 +604,12 @@ SALOMEDS::TMPFile* GEOM_Gen_i::Save(SALOMEDS::SComponent_ptr theComponent,
   // Build a full file name of temporary file
   TCollection_AsciiString aFullName = TCollection_AsciiString((char*)aTmpDir.c_str()) + aNameWithExt;
   // Save GEOM component in this file
-  _impl->Save((char*) aFullName.ToCString());
-  // Conver a file to the byte stream
-  aStreamFile = SALOMEDS_Tool::PutFilesToStream(aTmpDir.c_str(), aSeq, isMultiFile);
-  // Remove the created file and tmp directory
-  if (!isMultiFile) SALOMEDS_Tool::RemoveTemporaryFiles(aTmpDir.c_str(), aSeq, true);
-
+  if (_impl->Save((char*) aFullName.ToCString())) {
+    // Convert a file to the byte stream
+    aStreamFile = SALOMEDS_Tool::PutFilesToStream(aTmpDir.c_str(), aSeq, isMultiFile);
+    // Remove the created file and tmp directory
+    if (!isMultiFile) SALOMEDS_Tool::RemoveTemporaryFiles(aTmpDir.c_str(), aSeq, true);
+  }
   // Return the created byte stream
   return aStreamFile._retn();
 }