createIdentifierString() is not independent of the plug-in's file location

Hi,

Our code is relying on this function to store plugins in projects, instead of using xml. But it makes projects not portable:

Description says that createIdentifierString() should be plugin path agnostic: JUCE: PluginDescription Class Reference

but it’s definitely generates hash on plugin’s path:

static String getPluginDescSuffix (const PluginDescription& d, int uid)
{
    return "-" + String::toHexString (d.fileOrIdentifier.hashCode())
         + "-" + String::toHexString (uid);
}

I’ve tested it with GitHub - ffAudio/AudioPluginScanner: Scans file or folder for available audio plugins (JUCE) (just added createIdentifierString() output):

./AudioPluginScanner --file="/usr/lib64/vst/helm.so" --plugin="dbfile"
JUCE v7.0.7
scanning file: /usr/lib64/vst/helm.so
Attempting to load VST: /usr/lib64/vst/helm.so
Creating VST instance: helm
Initialising VST: helm (0.0.9.0)
VST-helm-7217d5be-48656c6d

and the same in another dir:

./AudioPluginScanner --file="/home/kv/.vst/helm.so" --plugin="dbfile"
JUCE v7.0.7
scanning file: /home/kv/.vst/helm.so
Attempting to load VST: /home/kv/.vst/helm.so
Creating VST instance: helm
Initialising VST: helm (0.0.9.0)
VST-helm-2c4fe109-48656c6d

OK the docs on that function are clearly misleading! I’m a bit concerned about just changing the implementation of the function at fear of potentially breaking a lot of existing projects even if the function isn’t doing what it says it should do. I would also need to take a closer look at where we are relying on this internally too.

If you are intending to store this to restore plugins across platforms would using PluginDescription.uniqueId work for you?

If so I could update the docs for this function to guide users to using that identifier instead.

Yes, we can use just uniqueId. This function was taken because of simple representation of plugin “Type-Name-ID”.
I think it’s not worth to change the behavior as this would break other people’s code.

1 Like

Thanks for the update I think I’ll update the docs to hopefully reduce confusion in the future, thanks for raising it!