mirror of
https://github.com/cookiengineer/audacity
synced 2025-05-04 17:49:45 +02:00
Remove path separator characters from plugin IDs when saving
The characters were a problem on Linux since wxFileConfig was intepreting them and creating extra (unwanted) groups. This change will suffice until/if this is converted to XML.
This commit is contained in:
parent
7bb4b7c941
commit
a4b3ece538
@ -1386,16 +1386,20 @@ void PluginManager::LoadGroup(const wxChar * group, PluginType type)
|
||||
{
|
||||
PluginDescriptor plug;
|
||||
|
||||
mConfig->SetPath(groupName);
|
||||
|
||||
groupName = ConvertID(groupName);
|
||||
|
||||
// Bypass group if the ID is already in use
|
||||
if (mPlugins.find(wxString(groupName)) != mPlugins.end())
|
||||
if (mPlugins.find(groupName) != mPlugins.end())
|
||||
{
|
||||
mConfig->SetPath(wxT(".."));
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
mConfig->SetPath(groupName);
|
||||
|
||||
// Set the ID and type
|
||||
plug.SetID(wxString(groupName));
|
||||
plug.SetID(groupName);
|
||||
plug.SetPluginType(type);
|
||||
|
||||
// Get the provider ID and bypass group if not found
|
||||
@ -1588,7 +1592,7 @@ void PluginManager::SaveGroup(const wxChar *group, PluginType type)
|
||||
continue;
|
||||
}
|
||||
|
||||
mConfig->SetPath(CACHEROOT + group + wxCONFIG_PATH_SEPARATOR + plug.GetID());
|
||||
mConfig->SetPath(CACHEROOT + group + wxCONFIG_PATH_SEPARATOR + ConvertID(plug.GetID()));
|
||||
|
||||
mConfig->Write(KEY_PATH, plug.GetPath());
|
||||
mConfig->Write(KEY_NAME, plug.GetName());
|
||||
@ -2212,7 +2216,7 @@ wxString PluginManager::SharedKey(const PluginID & ID, const wxString & group, c
|
||||
}
|
||||
|
||||
wxString path = CACHEROOT +
|
||||
mPlugins[ID].GetProviderID() +
|
||||
ConvertID(mPlugins[ID].GetProviderID()) +
|
||||
wxCONFIG_PATH_SEPARATOR +
|
||||
wxT("private") +
|
||||
wxCONFIG_PATH_SEPARATOR;
|
||||
@ -2234,7 +2238,7 @@ wxString PluginManager::PrivateKey(const PluginID & ID, const wxString & group,
|
||||
}
|
||||
|
||||
wxString path = CACHEROOT +
|
||||
ID +
|
||||
ConvertID(ID) +
|
||||
wxCONFIG_PATH_SEPARATOR +
|
||||
wxT("private") +
|
||||
wxCONFIG_PATH_SEPARATOR;
|
||||
@ -2248,3 +2252,25 @@ wxString PluginManager::PrivateKey(const PluginID & ID, const wxString & group,
|
||||
return path + key;
|
||||
}
|
||||
|
||||
// Sanitize the ID...not the best solution, but will suffice until this
|
||||
// is converted to XML
|
||||
wxString PluginManager::ConvertID(const PluginID & ID)
|
||||
{
|
||||
wxString id = ID;
|
||||
size_t cnt = 0;
|
||||
|
||||
cnt += id.Replace(wxT("\x01"), wxT(":"));
|
||||
cnt += id.Replace(wxT("\x02"), wxT("/"));
|
||||
cnt += id.Replace(wxT("\x03"), wxT("\\"));
|
||||
|
||||
if (cnt > 0)
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
id.Replace(wxT(":"), wxT("\x01"));
|
||||
id.Replace(wxT("/"), wxT("\x02"));
|
||||
id.Replace(wxT("\\"), wxT("\x03"));
|
||||
|
||||
return id;
|
||||
}
|
||||
|
@ -250,6 +250,7 @@ private:
|
||||
|
||||
wxString SharedKey(const PluginID & ID, const wxString & group, const wxString & key);
|
||||
wxString PrivateKey(const PluginID & ID, const wxString & group, const wxString & key);
|
||||
wxString ConvertID(const PluginID & ID);
|
||||
|
||||
private:
|
||||
static PluginManager mInstance;
|
||||
|
Loading…
x
Reference in New Issue
Block a user