1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-04-30 15:49:41 +02:00

AUP3: Remove active projects experiment

As we now have an explanation.
This commit is contained in:
Leland Lucius 2020-08-03 10:20:25 -05:00
parent 790e311f6f
commit 6bf29da525

View File

@ -13,37 +13,14 @@
#include "Audacity.h"
#include "ActiveProjects.h"
#include "FileNames.h"
#include "Prefs.h"
#include <wx/arrstr.h>
#include <wx/file.h>
#include <wx/filename.h>
FilePaths ActiveProjects::GetAll()
{
FilePaths files;
wxFileName fn(FileNames::DataDir(), wxT("activeprojects.cfg"));
wxFile file;
if (file.Open(fn.GetFullPath(), wxFile::OpenMode::read))
{
wxString lines;
if (file.ReadAll(&lines))
{
files = wxSplit(lines, wxT('\n'));
for (int i = files.size() - 1; i >= 0; --i)
{
if (files[i].empty())
{
files.RemoveAt(i);
}
}
}
}
return files;
#if 0
wxString key;
long ndx;
@ -60,31 +37,12 @@ FilePaths ActiveProjects::GetAll()
more = gPrefs->GetNextEntry(key, ndx);
}
gPrefs->SetPath(configPath);
#endif
return files;
}
void ActiveProjects::Add(const FilePath &path)
{
FilePaths files = GetAll();
if (files.Index(path) != wxNOT_FOUND)
{
return;
}
files.Add(path);
wxString lines = wxJoin(files, wxT('\n')) + wxT('\n');
wxFileName fn(FileNames::DataDir(), wxT("activeprojects.cfg"));
wxFile file;
if (file.Create(fn.GetFullPath(), true))
{
file.Write(lines);
file.Close();
}
#if 0
wxString key = Find(path);
if (key.empty())
@ -98,31 +56,10 @@ void ActiveProjects::Add(const FilePath &path)
gPrefs->Write(key, path);
gPrefs->Flush();
}
#endif
}
void ActiveProjects::Remove(const FilePath &path)
{
FilePaths files = GetAll();
int ndx = files.Index(path);
if (ndx == wxNOT_FOUND)
{
return;
}
files.RemoveAt(ndx);
wxString lines = wxJoin(files, wxT('\n')) + wxT('\n');
wxFileName fn(FileNames::DataDir(), wxT("activeprojects.cfg"));
wxFile file;
if (file.Create(fn.GetFullPath(), true))
{
file.Write(lines);
file.Close();
}
#if 0
wxString key = Find(path);
if (!key.empty())
@ -130,7 +67,6 @@ void ActiveProjects::Remove(const FilePath &path)
gPrefs->DeleteEntry(wxT("/ActiveProjects/" + key));
gPrefs->Flush();
}
#endif
}
wxString ActiveProjects::Find(const FilePath &path)