Browse Source

Made KnownPluginList::getTypeForIdentifierString handle shell plugin IDs.

tags/2021-05-28
jules 10 years ago
parent
commit
e6e5d34152
3 changed files with 23 additions and 7 deletions
  1. +13
    -5
      modules/juce_audio_processors/processors/juce_PluginDescription.cpp
  2. +9
    -1
      modules/juce_audio_processors/processors/juce_PluginDescription.h
  3. +1
    -1
      modules/juce_audio_processors/scanning/juce_KnownPluginList.cpp

+ 13
- 5
modules/juce_audio_processors/processors/juce_PluginDescription.cpp View File

@@ -71,18 +71,26 @@ PluginDescription& PluginDescription::operator= (const PluginDescription& other)
return *this;
}
bool PluginDescription::isDuplicateOf (const PluginDescription& other) const
bool PluginDescription::isDuplicateOf (const PluginDescription& other) const noexcept
{
return fileOrIdentifier == other.fileOrIdentifier
&& uid == other.uid;
}
static String getPluginDescSuffix (const PluginDescription& d)
{
return "-" + String::toHexString (d.fileOrIdentifier.hashCode())
+ "-" + String::toHexString (d.uid);
}
bool PluginDescription::matchesIdentifierString (const String& identifierString) const
{
return identifierString.endsWithIgnoreCase (getPluginDescSuffix (*this));
}
String PluginDescription::createIdentifierString() const
{
return pluginFormatName
+ "-" + name
+ "-" + String::toHexString (fileOrIdentifier.hashCode())
+ "-" + String::toHexString (uid);
return pluginFormatName + "-" + name + getPluginDescSuffix (*this);
}
XmlElement* PluginDescription::createXml() const


+ 9
- 1
modules/juce_audio_processors/processors/juce_PluginDescription.h View File

@@ -107,7 +107,15 @@ public:
This isn't quite as simple as them just having the same file (because of
shell plug-ins).
*/
bool isDuplicateOf (const PluginDescription& other) const;
bool isDuplicateOf (const PluginDescription& other) const noexcept;
/** Return true if this description is equivalent to another one which created the
given identifier string.
Note that this isn't quite as simple as them just calling createIdentifierString()
and comparing the strings, because the identifers can differ (thanks to shell plug-ins).
*/
bool matchesIdentifierString (const String& identifierString) const;
//==============================================================================
/** Returns a string that can be saved and used to uniquely identify the


+ 1
- 1
modules/juce_audio_processors/scanning/juce_KnownPluginList.cpp View File

@@ -46,7 +46,7 @@ PluginDescription* KnownPluginList::getTypeForFile (const String& fileOrIdentifi
PluginDescription* KnownPluginList::getTypeForIdentifierString (const String& identifierString) const
{
for (int i = 0; i < types.size(); ++i)
if (types.getUnchecked(i)->createIdentifierString() == identifierString)
if (types.getUnchecked(i)->matchesIdentifierString (identifierString))
return types.getUnchecked(i);
return nullptr;


Loading…
Cancel
Save