From 341e3e120712e104915fe9a067ea1325ad3a2ae2 Mon Sep 17 00:00:00 2001 From: Steve Daulton Date: Sat, 17 Sep 2016 15:52:52 +0100 Subject: [PATCH] Fix bug 1513 The error message is still a bit strange if trying to overwrite a different project when the current project has been saved, (why would you do that?), but probably not worth complicating the message for such a fringe case. --- src/TimerRecordDialog.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/TimerRecordDialog.cpp b/src/TimerRecordDialog.cpp index 3e0a0f614..fb99d5879 100644 --- a/src/TimerRecordDialog.cpp +++ b/src/TimerRecordDialog.cpp @@ -301,19 +301,24 @@ void TimerRecordDialog::OnAutoSavePathButton_Click(wxCommandEvent& WXUNUSED(even if (fName == wxT("")) return; - // MY: If project already exits then abort - we do not allow users to overwrite an existing project - if (wxFileExists(fName)) { + AudacityProject* pProject = GetActiveProject(); + + // If project already exits then abort - we do not allow users to overwrite an existing project + // unless it is the current project. + if (wxFileExists(fName) && (pProject->GetFileName() != fName)) { wxMessageDialog m( NULL, - _("The selected file name could not be used\nfor Timer Recording because it would overwrite another project.\nPlease try again and select an original name."), + _("The selected file name could not be used\nfor Timer Recording because it \ +would overwrite another project.\nPlease try again and select an original name."), _("Error Saving Timer Recording Project"), wxOK|wxICON_ERROR); m.ShowModal(); return; } - // MY: Set this boolean to false so we now do a SaveAs at the end of the recording - m_bProjectAlreadySaved = false; + // Set this boolean to false so we now do a SaveAs at the end of the recording + // unless we're saving the current project. + m_bProjectAlreadySaved = pProject->GetFileName() == fName? true : false; m_fnAutoSaveFile = fName; m_fnAutoSaveFile.SetExt(wxT("aup"));