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

AUP3: UP-17 - Projects can be larger on UP-3.0.0

Partial relief only.  This only addresses first symptom and it
will needs to have a progress dialog added.
This commit is contained in:
Leland Lucius
2020-07-05 23:24:25 -05:00
parent 2084c39046
commit f7db5043c5
2 changed files with 10 additions and 45 deletions

View File

@@ -287,6 +287,15 @@ bool ProjectFileIO::CloseDB()
if (mDB) if (mDB)
{ {
if (!mTemporary)
{
rc = sqlite3_exec(mDB, "VACUUM;", nullptr, nullptr, nullptr);
if (rc != SQLITE_OK)
{
wxLogError(XO("Vacuuming failed while closing project file").Translation());
}
}
rc = sqlite3_close(mDB); rc = sqlite3_close(mDB);
if (rc != SQLITE_OK) if (rc != SQLITE_OK)
{ {
@@ -321,50 +330,6 @@ bool ProjectFileIO::DeleteDB()
return true; return true;
} }
bool ProjectFileIO::CleanDB()
{
auto db = DB();
int rc;
AutoSave();
wxString destpath = wxFileName::CreateTempFileName(mFileName + ".xxxxx");
if (CopyTo(destpath))
{
if (CloseDB())
{
wxString tmppath = wxFileName::CreateTempFileName(mFileName + ".xxxxx");
if (wxRename(mFileName, tmppath) == 0)
{
if (wxRename(destpath, mFileName) == 0)
{
wxRemoveFile(tmppath);
// Success
return true;
}
if (wxRename(tmppath, mFileName) == 0)
{
wxRemoveFile(destpath);
}
else
{
SetError(XO("Could not rename %s back to %s during cleaning").Format(tmppath, mFileName));
}
}
else
{
SetError(XO("Could not rename %s during cleaning").Format(mFileName));
}
}
}
// AUD3 TODO COMPILAIN
return false;
}
bool ProjectFileIO::TransactionStart(const wxString &name) bool ProjectFileIO::TransactionStart(const wxString &name)
{ {
char* errmsg = nullptr; char* errmsg = nullptr;
@@ -1259,6 +1224,7 @@ bool ProjectFileIO::SaveProject(const FilePath &fileName)
// We need to remove the autosave info from the file since it is now // We need to remove the autosave info from the file since it is now
// clean and unmodified. Otherwise, it would be considered "recovered" // clean and unmodified. Otherwise, it would be considered "recovered"
// when next opened. // when next opened.
AutoSaveDelete(); AutoSaveDelete();
// No longer modified // No longer modified

View File

@@ -113,7 +113,6 @@ private:
sqlite3 *OpenDB(FilePath fileName = {}); sqlite3 *OpenDB(FilePath fileName = {});
bool CloseDB(); bool CloseDB();
bool DeleteDB(); bool DeleteDB();
bool CleanDB();
bool TransactionStart(const wxString &name); bool TransactionStart(const wxString &name);
bool TransactionCommit(const wxString &name); bool TransactionCommit(const wxString &name);