1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-05-06 14:52:34 +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();
CloseWithoutEndingTags();
if (mKeepBackup) {
if (! mBackupFile.Close() ||
! wxRenameFile( mOutputPath, mBackupName ) )
ThrowException( mBackupName, mCaption );
}
else {
if ( ! wxRemoveFile( mOutputPath ) )
ThrowException( mOutputPath, mCaption );
// JKC: NOT translating error messages. Rationale is that they should
// not be seen, and if they are the untranslated version is more useful to
// developers.
if ( mKeepBackup) {
if (! mBackupFile.Close() || ! wxRenameFile( mOutputPath, mBackupName ) )
ThrowException( mBackupName, mCaption + " renaming backup");
}
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.
// But not completely finished with steps of the commit operation.