]> SALOME platform Git repositories - modules/smesh.git/commitdiff
Salome HOME
PAL11238: Crash in ExportMED.
authorjfa <jfa@opencascade.com>
Fri, 13 Jan 2006 15:31:06 +0000 (15:31 +0000)
committerjfa <jfa@opencascade.com>
Fri, 13 Jan 2006 15:31:06 +0000 (15:31 +0000)
src/SMESH_I/SMESH_Mesh_i.cxx

index 604f3dd0b264e7a1b79f4a838554ae6a546ba81f..d6b5b420d0971bdf4702fd0985a2b334f4e6ca3a 100644 (file)
@@ -1095,29 +1095,16 @@ static void PrepareForWriting (const char* file)
       THROW_SALOME_CORBA_EXCEPTION(msg.ToCString(), SALOME::BAD_PARAM);
     }
   } else {
-    // nonexisting file
-    TCollection_AsciiString aDirName = aPath.TrekValue(aPath.TrekLength());
-    aPath.UpTrek();
-    aPath.SetName(aDirName);
-    aPath.SetExtension("");
-    OSD_Directory aDir (aPath);
-    TCollection_AsciiString aFullDirName;
-    aPath.SystemName(aFullDirName);
-    if (aDir.Exists()) {
-      aFile.Reset();
-      aFile.Build(OSD_WriteOnly, OSD_Protection());
-      if (aFile.Failed()) {
-        TCollection_AsciiString msg ("You cannot write to directory ");
-        msg += aFullDirName + ".";
-        THROW_SALOME_CORBA_EXCEPTION(msg.ToCString(), SALOME::BAD_PARAM);
-      } else {
-        aFile.Close();
-        aFile.Remove();
-      }
-    } else {
-      TCollection_AsciiString msg ("Directory ");
-      msg += aFullDirName + " does not exist.";
+    // nonexisting file; check if it can be created
+    aFile.Reset();
+    aFile.Build(OSD_WriteOnly, OSD_Protection());
+    if (aFile.Failed()) {
+      TCollection_AsciiString msg ("You cannot create the file ");
+      msg += aFullName + ". Check the directory existance and access rights.";
       THROW_SALOME_CORBA_EXCEPTION(msg.ToCString(), SALOME::BAD_PARAM);
+    } else {
+      aFile.Close();
+      aFile.Remove();
     }
   }
 }