mirror of
https://github.com/cookiengineer/audacity
synced 2025-12-28 07:28:47 +01:00
Bug1521, bug1567 Mac: wipe .DS_Store in temp folder when saving too
This commit is contained in:
@@ -398,6 +398,13 @@ DirManager::~DirManager()
|
|||||||
|
|
||||||
// static
|
// static
|
||||||
void DirManager::CleanTempDir()
|
void DirManager::CleanTempDir()
|
||||||
|
{
|
||||||
|
CleanDir(globaltemp, wxT("project*"), _("Cleaning up temporary files"));
|
||||||
|
}
|
||||||
|
|
||||||
|
// static
|
||||||
|
void DirManager::CleanDir(
|
||||||
|
const wxString &path, const wxString &dirSpec, const wxString &msg)
|
||||||
{
|
{
|
||||||
if (dontDeleteTempFiles)
|
if (dontDeleteTempFiles)
|
||||||
return; // do nothing
|
return; // do nothing
|
||||||
@@ -407,9 +414,9 @@ void DirManager::CleanTempDir()
|
|||||||
// Subtract 1 because we don't want to DELETE the global temp directory,
|
// Subtract 1 because we don't want to DELETE the global temp directory,
|
||||||
// which this will find and list last.
|
// which this will find and list last.
|
||||||
int countFiles =
|
int countFiles =
|
||||||
RecursivelyEnumerate(globaltemp, filePathArray, wxT("project*"), true, false);
|
RecursivelyEnumerate(path, filePathArray, dirSpec, true, false);
|
||||||
int countDirs =
|
int countDirs =
|
||||||
RecursivelyEnumerate(globaltemp, dirPathArray, wxT("project*"), false, true) - 1;
|
RecursivelyEnumerate(path, dirPathArray, dirSpec, false, true) - 1;
|
||||||
// Remove the globaltemp itself from the array
|
// Remove the globaltemp itself from the array
|
||||||
dirPathArray.resize(countDirs);
|
dirPathArray.resize(countDirs);
|
||||||
|
|
||||||
@@ -417,7 +424,6 @@ void DirManager::CleanTempDir()
|
|||||||
if (count == 0)
|
if (count == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto msg = _("Cleaning up temporary files");
|
|
||||||
RecursivelyRemove(filePathArray, count, 0, true, false, msg);
|
RecursivelyRemove(filePathArray, count, 0, true, false, msg);
|
||||||
RecursivelyRemove(dirPathArray, count, countFiles, false, true, msg);
|
RecursivelyRemove(dirPathArray, count, countFiles, false, true, msg);
|
||||||
}
|
}
|
||||||
@@ -541,15 +547,11 @@ bool DirManager::SetProject(wxString& newProjPath, wxString& newProjName, const
|
|||||||
// recurse depth-first and rmdir every directory seen in old and
|
// recurse depth-first and rmdir every directory seen in old and
|
||||||
// NEW; rmdir will fail on non-empty dirs.
|
// NEW; rmdir will fail on non-empty dirs.
|
||||||
|
|
||||||
wxArrayString dirlist;
|
CleanDir(cleanupLoc1, wxEmptyString, _("Cleaning up cache directories"));
|
||||||
const int count = RecursivelyEnumerate(cleanupLoc1, dirlist, wxEmptyString, false, true);
|
|
||||||
|
|
||||||
//This destroys the empty dirs of the OD block files, which are yet to come.
|
//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)
|
//Dont know if this will make the project dirty, but I doubt it. (mchinen)
|
||||||
// count += RecursivelyEnumerate(cleanupLoc2, dirlist, wxEmptyString, false, true);
|
// count += RecursivelyEnumerate(cleanupLoc2, dirlist, wxEmptyString, false, true);
|
||||||
|
|
||||||
if (count > 0)
|
|
||||||
RecursivelyRemove(dirlist, count, 0, false, true, _("Cleaning up cache directories"));
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -122,6 +122,8 @@ class PROFILE_DLL_API DirManager final : public XMLTagHandler {
|
|||||||
// dir is not cleaned at start up anymore. But it is cleaned when the
|
// dir is not cleaned at start up anymore. But it is cleaned when the
|
||||||
// program is exited normally.
|
// program is exited normally.
|
||||||
static void CleanTempDir();
|
static void CleanTempDir();
|
||||||
|
static void CleanDir(
|
||||||
|
const wxString &path, const wxString &dirSpec, const wxString &msg);
|
||||||
|
|
||||||
// Check the project for errors and possibly prompt user
|
// Check the project for errors and possibly prompt user
|
||||||
// bForceError: Always show log error alert even if no errors are found here.
|
// bForceError: Always show log error alert even if no errors are found here.
|
||||||
|
|||||||
Reference in New Issue
Block a user