1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-22 23:30:07 +02:00

Bug 1610 - Unable to save projects

We were throwing an exception for attempting to delete a file that was not there.
This commit is contained in:
James Crook 2017-03-20 11:53:39 +00:00
parent 8f71aa67df
commit 5b9ae95930

View File

@ -321,15 +321,17 @@ void XMLFileWriter::Commit()
auto tempPath = GetName(); auto tempPath = GetName();
CloseWithoutEndingTags(); CloseWithoutEndingTags();
if (mKeepBackup) { // JKC: NOT translating error messages. Rationale is that they should
if (! mBackupFile.Close() || // not be seen, and if they are the untranslated version is more useful to
! wxRenameFile( mOutputPath, mBackupName ) ) // developers.
ThrowException( mBackupName, mCaption ); if ( mKeepBackup) {
} if (! mBackupFile.Close() || ! wxRenameFile( mOutputPath, mBackupName ) )
else { ThrowException( mBackupName, mCaption + " renaming backup");
if ( ! wxRemoveFile( mOutputPath ) )
ThrowException( mOutputPath, mCaption );
} }
else if (! wxFileExists( mOutputPath ) );
else if (! wxRemoveFile( mOutputPath ) )
ThrowException( mOutputPath, mCaption + " removing old version");
// Now we have vacated the file at the output path and are committed. // Now we have vacated the file at the output path and are committed.
// But not completely finished with steps of the commit operation. // But not completely finished with steps of the commit operation.