Weird behaviour in VSTPluginFormat::getDefaultLocationsToSearch()


#1

There’s something dodgy in the code that returns the default plug-in location for the VST format on Windows:

const String programFiles (File::getSpecialLocation (File::globalApplicationsDirectory).getFullPathName());

FileSearchPath paths;
paths.add (WindowsRegistry::getValue ("HKEY_LOCAL_MACHINE\\Software\\VST\\VSTPluginsPath",
                                      programFiles + "\\Steinberg\\VstPlugins"));
paths.removeNonExistentPaths();

paths.add (WindowsRegistry::getValue ("HKEY_LOCAL_MACHINE\\Software\\VST\\VSTPluginsPath",
                                      programFiles + "\\VstPlugins"));
return paths;

If the registry entry is set, you’ll end up with two identical paths. Looks like a merging error to me…

Best,
Stian


#2

Hmm, I guess we just need to add a call to paths.removeRedundantPaths() before it gets returned?


#3

Thanks for the quick reply, Jules. Yes, or maybe this like below?

const String programFiles (File::getSpecialLocation (File::globalApplicationsDirectory).getFullPathName());

FileSearchPath paths;

paths.add (WindowsRegistry::getValue ("HKEY_LOCAL_MACHINE\\Software\\VST\\VSTPluginsPath"));
paths.addIfNotAlreadyThere (programFiles + "\\Steinberg\\VstPlugins");
paths.addIfNotAlreadyThere (programFiles + "\\VstPlugins");

paths.removeNonExistentPaths();

return paths;

#4

Yep, that’s a nice way to do it. Will push something to fix this.


#5

Excellent, thanks! :slight_smile: