1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-08-06 07:09:39 +02:00

fix the XML writer -- don't throw if target path did not previously exist.

This commit is contained in:
Paul Licameli 2017-03-18 15:04:51 -04:00
parent d812b7f8a4
commit e9a4fc8354

View File

@ -321,17 +321,16 @@ void XMLFileWriter::Commit()
auto tempPath = GetName();
CloseWithoutEndingTags();
// 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");
if (mKeepBackup) {
if (! mBackupFile.Close() ||
! wxRenameFile( mOutputPath, mBackupName ) )
ThrowException( mBackupName, mCaption );
}
else {
if ( wxFileName::FileExists( mOutputPath ) &&
! 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.
// But not completely finished with steps of the commit operation.