mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-16 16:10:06 +02:00
AUP3: Do not physically delete project if not temp
This commit is contained in:
parent
a4554d3631
commit
38d13ebdc0
@ -242,27 +242,39 @@ void AutoRecoveryDialog::OnDiscardSelected(wxCommandEvent &WXUNUSED(evt))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
FilePath file = mFiles[item];
|
||||
FilePath fileName = mFiles[item];
|
||||
|
||||
if (wxRemoveFile(file))
|
||||
// Only remove it from disk if it appears to be a temporary file.
|
||||
wxFileName file(fileName);
|
||||
if (file.GetExt().IsSameAs(FileNames::UnsavedProjectExtension()))
|
||||
{
|
||||
if (wxFileExists(file + wxT("-shm")))
|
||||
{
|
||||
wxRemoveFile(file + wxT("-shm"));
|
||||
}
|
||||
file.SetFullName(wxT(""));
|
||||
|
||||
if (wxFileExists(file + wxT("-wal")))
|
||||
wxFileName temp(FileNames::TempDir(), wxT(""));
|
||||
if (file == temp)
|
||||
{
|
||||
wxRemoveFile(file + wxT("-wal"));
|
||||
}
|
||||
if (wxRemoveFile(fileName))
|
||||
{
|
||||
if (wxFileExists(fileName + wxT("-shm")))
|
||||
{
|
||||
wxRemoveFile(fileName + wxT("-shm"));
|
||||
}
|
||||
|
||||
if (wxFileExists(file + wxT("-journal")))
|
||||
{
|
||||
wxRemoveFile(file + wxT("-journal"));
|
||||
}
|
||||
if (wxFileExists(fileName + wxT("-wal")))
|
||||
{
|
||||
wxRemoveFile(fileName + wxT("-wal"));
|
||||
}
|
||||
|
||||
ActiveProjects::Remove(file);
|
||||
if (wxFileExists(fileName + wxT("-journal")))
|
||||
{
|
||||
wxRemoveFile(fileName + wxT("-journal"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Forget all about it
|
||||
ActiveProjects::Remove(fileName);
|
||||
}
|
||||
|
||||
PopulateList();
|
||||
|
Loading…
x
Reference in New Issue
Block a user