1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-11-14 17:14:07 +01:00

Flush .aup before writing .au; no redundant out-of-space messages

This commit is contained in:
Paul Licameli
2017-10-24 14:46:32 -04:00
parent 7eeb88384d
commit 58f07d2021
3 changed files with 41 additions and 8 deletions

View File

@@ -313,14 +313,25 @@ XMLFileWriter::~XMLFileWriter()
void XMLFileWriter::Commit()
// may throw
{
PreCommit();
PostCommit();
}
void XMLFileWriter::PreCommit()
// may throw
{
while (mTagstack.GetCount()) {
EndTag(mTagstack[0]);
}
auto tempPath = GetName();
CloseWithoutEndingTags();
}
void XMLFileWriter::PostCommit()
// may throw
{
auto tempPath = GetName();
if (mKeepBackup) {
if (! mBackupFile.Close() ||
! wxRenameFile( mOutputPath, mBackupName ) )

View File

@@ -86,8 +86,16 @@ class AUDACITY_DLL_API XMLFileWriter final : private wxFFile, public XMLWriter {
/// Close all tags and then close the file.
/// Might throw. If not, then create
/// or modify the file at the output path.
/// Composed of two steps, PreCommit() and PostCommit()
void Commit();
/// Does the part of Commit that might fail because of exhaustion of space
void PreCommit();
/// Does other parts of Commit that are not likely to fail for exhaustion
/// of space, but might for other reasons
void PostCommit();
/// Write to file. Might throw.
void Write(const wxString &data) override;