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:
@@ -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 ) )
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user