- if (aFile.KindOfFile() == OSD_FILE) {
- if (aFile.IsWriteable()) {
- if (overwrite) {
- aFile.Reset();
- aFile.Remove();
- }
- if (aFile.Failed()) {
- TCollection_AsciiString msg ("File ");
- msg += aFullName + " cannot be replaced.";
- THROW_SALOME_CORBA_EXCEPTION(msg.ToCString(), SALOME::BAD_PARAM);
+ if ( !aFile.isDirectory() ) {
+ if ( aFile.openForWriting() ) {
+ if ( overwrite && ! aFile.remove()) {
+ msg << "Can't replace " << aFile.getName();