1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-08-08 08:01:19 +02:00

Bug1590: Mac skips plugin cfg entries for .ny's of other versions...

... This conservative fix depends on where you put the executable bundle.

Assuing the executable is in /Applications, and the other Audacity version
(past or future) is there too (either bundled as for 2.1.3 and later, or
in a folder as for 2.1.2 and previous):

The .ny files that are part of the other version's shipment are ignored, and
therefore the Effects menu avoids duplicates.

But the .cfg file is not rewritten to eliminate them, in case you want to
switch back to the other version.  If that other version is 2.1.3 or earlier,
sorry but you will see duplicates.
This commit is contained in:
Paul Licameli 2017-07-25 23:20:10 -04:00
parent fa42d4f661
commit 34f8e79623

View File

@ -1770,6 +1770,40 @@ void PluginManager::Load()
void PluginManager::LoadGroup(wxFileConfig *pRegistry, PluginType type)
{
#ifdef __WXMAC__
// Bug 1590: On Mac, we should purge the registry of Nyquist plug-ins
// bundled with other versions of Audacity, assuming both versions
// were properly installed in /Applications (or whatever it is called in
// your locale)
const auto fullExePath = PlatformCompatibility::GetExecutablePath();
// Strip rightmost path components up to *.app
wxFileName exeFn{ fullExePath };
exeFn.SetEmptyExt();
exeFn.SetName(wxString{});
while(exeFn.GetDirCount() && !exeFn.GetDirs().Last().EndsWith(".app"))
exeFn.RemoveLastDir();
const auto goodPath = exeFn.GetPath();
if(exeFn.GetDirCount())
exeFn.RemoveLastDir();
const auto possiblyBadPath = exeFn.GetPath();
auto AcceptPath = [&](const wxString &path) {
if (!path.StartsWith(possiblyBadPath))
// Assume it's not under /Applications
return true;
if (path.StartsWith(goodPath))
// It's bundled with this executable
return true;
return false;
};
#else
auto AcceptPath = [](const wxString&){ return true; };
#endif
wxString strVal;
bool boolVal;
wxString groupName;
@ -1814,6 +1848,11 @@ void PluginManager::LoadGroup(wxFileConfig *pRegistry, PluginType type)
// Get the path (optional)
pRegistry->Read(KEY_PATH, &strVal, wxEmptyString);
if (!AcceptPath(strVal))
// Ignore the obsolete path in the config file, during session,
// but don't remove it from the file. Maybe you really want to
// switch back to the other version of Audacity and lose nothing.
continue;
plug.SetPath(strVal);
// Get the name and bypass group if not found