mirror of
https://github.com/cookiengineer/audacity
synced 2025-08-16 08:34:10 +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;
|
PluginDescriptor plug;
|
||||||
|
|
||||||
|
mConfig->SetPath(groupName);
|
||||||
|
|
||||||
|
groupName = ConvertID(groupName);
|
||||||
|
|
||||||
// Bypass group if the ID is already in use
|
// 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;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
mConfig->SetPath(groupName);
|
|
||||||
|
|
||||||
// Set the ID and type
|
// Set the ID and type
|
||||||
plug.SetID(wxString(groupName));
|
plug.SetID(groupName);
|
||||||
plug.SetPluginType(type);
|
plug.SetPluginType(type);
|
||||||
|
|
||||||
// Get the provider ID and bypass group if not found
|
// Get the provider ID and bypass group if not found
|
||||||
@ -1588,7 +1592,7 @@ void PluginManager::SaveGroup(const wxChar *group, PluginType type)
|
|||||||
continue;
|
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_PATH, plug.GetPath());
|
||||||
mConfig->Write(KEY_NAME, plug.GetName());
|
mConfig->Write(KEY_NAME, plug.GetName());
|
||||||
@ -2212,7 +2216,7 @@ wxString PluginManager::SharedKey(const PluginID & ID, const wxString & group, c
|
|||||||
}
|
}
|
||||||
|
|
||||||
wxString path = CACHEROOT +
|
wxString path = CACHEROOT +
|
||||||
mPlugins[ID].GetProviderID() +
|
ConvertID(mPlugins[ID].GetProviderID()) +
|
||||||
wxCONFIG_PATH_SEPARATOR +
|
wxCONFIG_PATH_SEPARATOR +
|
||||||
wxT("private") +
|
wxT("private") +
|
||||||
wxCONFIG_PATH_SEPARATOR;
|
wxCONFIG_PATH_SEPARATOR;
|
||||||
@ -2234,7 +2238,7 @@ wxString PluginManager::PrivateKey(const PluginID & ID, const wxString & group,
|
|||||||
}
|
}
|
||||||
|
|
||||||
wxString path = CACHEROOT +
|
wxString path = CACHEROOT +
|
||||||
ID +
|
ConvertID(ID) +
|
||||||
wxCONFIG_PATH_SEPARATOR +
|
wxCONFIG_PATH_SEPARATOR +
|
||||||
wxT("private") +
|
wxT("private") +
|
||||||
wxCONFIG_PATH_SEPARATOR;
|
wxCONFIG_PATH_SEPARATOR;
|
||||||
@ -2248,3 +2252,25 @@ wxString PluginManager::PrivateKey(const PluginID & ID, const wxString & group,
|
|||||||
return path + key;
|
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 SharedKey(const PluginID & ID, const wxString & group, const wxString & key);
|
||||||
wxString PrivateKey(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:
|
private:
|
||||||
static PluginManager mInstance;
|
static PluginManager mInstance;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user