Bug 2669 - Win: Save As can be used to overwrite the existing project without warning

This commit is contained in:
Leland Lucius 2021-02-18 19:35:11 -06:00
parent db34fabb18
commit 8fce1db1ae
2 changed files with 4 additions and 4 deletions

View File

@ -220,7 +220,7 @@ bool ProjectFileManager::Save()
// Prompt for file name?
if (projectFileIO.IsTemporary())
{
return SaveAs();
return SaveAs(true);
}
return DoSave(projectFileIO.GetFileName(), false);
@ -409,7 +409,7 @@ bool ProjectFileManager::SaveAs(const FilePath &newFileName, bool addToHistory /
return(success);
}
bool ProjectFileManager::SaveAs()
bool ProjectFileManager::SaveAs(bool allowOverwrite /* = false */)
{
auto &project = mProject;
auto &projectFileIO = ProjectFileIO::Get( project );
@ -466,7 +466,7 @@ For an audio file that will open in other apps, use 'Export'.\n");
filename.SetExt(wxT("aup3"));
if (!bPrompt && filename.FileExists()) {
if ((!bPrompt || !allowOverwrite) && filename.FileExists()) {
// Saving a copy of the project should never overwrite an existing project.
AudacityMessageDialog m(
nullptr,

View File

@ -59,7 +59,7 @@ public:
void CompactProjectOnClose();
bool Save();
bool SaveAs();
bool SaveAs(bool allowOverwrite = false);
bool SaveAs(const FilePath &newFileName, bool addToHistory = true);
// strProjectPathName is full path for aup except extension
bool SaveFromTimerRecording( wxFileName fnFile );