mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-02-19 11:03:07 +05:00
PAL11238: Crash in ExportMED.
This commit is contained in:
parent
7957f9e2e8
commit
2fe605b57b
@ -1194,29 +1194,16 @@ static void PrepareForWriting (const char* file)
|
|||||||
THROW_SALOME_CORBA_EXCEPTION(msg.ToCString(), SALOME::BAD_PARAM);
|
THROW_SALOME_CORBA_EXCEPTION(msg.ToCString(), SALOME::BAD_PARAM);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// nonexisting file
|
// nonexisting file; check if it can be created
|
||||||
TCollection_AsciiString aDirName = aPath.TrekValue(aPath.TrekLength());
|
aFile.Reset();
|
||||||
aPath.UpTrek();
|
aFile.Build(OSD_WriteOnly, OSD_Protection());
|
||||||
aPath.SetName(aDirName);
|
if (aFile.Failed()) {
|
||||||
aPath.SetExtension("");
|
TCollection_AsciiString msg ("You cannot create the file ");
|
||||||
OSD_Directory aDir (aPath);
|
msg += aFullName + ". Check the directory existance and access rights.";
|
||||||
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.";
|
|
||||||
THROW_SALOME_CORBA_EXCEPTION(msg.ToCString(), SALOME::BAD_PARAM);
|
THROW_SALOME_CORBA_EXCEPTION(msg.ToCString(), SALOME::BAD_PARAM);
|
||||||
|
} else {
|
||||||
|
aFile.Close();
|
||||||
|
aFile.Remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user