1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-08-16 08:34:10 +02:00

Bug1521 residual: Save new project, still must remove project* folder

This commit is contained in:
Paul Licameli 2017-01-31 12:41:54 -05:00
parent 0cb89a895a
commit 5392feefd4
2 changed files with 12 additions and 6 deletions

View File

@ -404,7 +404,8 @@ void DirManager::CleanTempDir()
// static
void DirManager::CleanDir(
const wxString &path, const wxString &dirSpec, const wxString &msg)
const wxString &path, const wxString &dirSpec, const wxString &msg,
bool removeTop)
{
if (dontDeleteTempFiles)
return; // do nothing
@ -416,9 +417,12 @@ void DirManager::CleanDir(
int countFiles =
RecursivelyEnumerate(path, filePathArray, dirSpec, true, false);
int countDirs =
RecursivelyEnumerate(path, dirPathArray, dirSpec, false, true) - 1;
// Remove the globaltemp itself from the array
dirPathArray.resize(countDirs);
RecursivelyEnumerate(path, dirPathArray, dirSpec, false, true);
if (!removeTop) {
// Remove the globaltemp itself from the array
--countDirs;
dirPathArray.resize(countDirs);
}
auto count = countFiles + countDirs;
if (count == 0)
@ -547,7 +551,8 @@ bool DirManager::SetProject(wxString& newProjPath, wxString& newProjName, const
// recurse depth-first and rmdir every directory seen in old and
// NEW; rmdir will fail on non-empty dirs.
CleanDir(cleanupLoc1, wxEmptyString, _("Cleaning up cache directories"));
CleanDir(
cleanupLoc1, wxEmptyString, _("Cleaning up cache directories"), true);
//This destroys the empty dirs of the OD block files, which are yet to come.
//Dont know if this will make the project dirty, but I doubt it. (mchinen)

View File

@ -123,7 +123,8 @@ class PROFILE_DLL_API DirManager final : public XMLTagHandler {
// program is exited normally.
static void CleanTempDir();
static void CleanDir(
const wxString &path, const wxString &dirSpec, const wxString &msg);
const wxString &path, const wxString &dirSpec, const wxString &msg,
bool removeTop = false);
// Check the project for errors and possibly prompt user
// bForceError: Always show log error alert even if no errors are found here.