1
0
mirror of https://github.com/cookiengineer/audacity synced 2026-03-07 23:15:36 +01:00

Function for repeated check whether it is safe to overwrite project

This commit is contained in:
Paul Licameli
2021-05-19 07:49:31 -04:00
parent 1bed51ac80
commit 97cf411dd5
3 changed files with 28 additions and 35 deletions

View File

@@ -813,24 +813,8 @@ bool AudacityApp::MRUOpen(const FilePath &fullPathStr) {
if (ProjectFileManager::IsAlreadyOpen(fullPathStr))
return false;
// DMM: If the project is dirty, that means it's been touched at
// all, and it's not safe to open a NEW project directly in its
// place. Only if the project is brand-NEW clean and the user
// hasn't done any action at all is it safe for Open to take place
// inside the current project.
//
// If you try to Open a NEW project inside the current window when
// there are no tracks, but there's an Undo history, etc, then
// bad things can happen, including data files moving to the NEW
// project directory, etc.
if (proj && (
ProjectHistory::Get( *proj ).GetDirty() ||
!TrackList::Get( *proj ).empty()
) )
if (proj && !ProjectManager::SafeToOpenProjectInto(*proj))
proj = nullptr;
// This project is clean; it's never been touched. Therefore
// all relevant member variables are in their initial state,
// and it's okay to open a NEW project inside this window.
( void ) ProjectManager::OpenProject( proj, fullPathStr );
}
else {