Hi Jules,
When attempting in using the juce::VSTPluginFormat::getDefaultLocationsToSearch(), I noticed it’s giving me a non-existent folder.
The reason being; on 32-bit Windows boxes, the default VST folder location is the following (assumes Windows is installed on drive C:) (see the note):
On 64-bit Windows boxes, the default VST folder locations are:
As per your code, the path to a default folder is the following on my current 64-bit machine: “C:\Program Files (x86)\Steinberg\VstPlugins” (a folder which does not exist). (I’ve only been working with free, copy/pasta, plugins - no installation files… so I don’t even have a Steinberg registry or folder.)
Note: This applies to Win7 and Win8 (and would assume Vista too). Was empirically tested by checking out the settings of the DAWs I use (fresh installations - therefore defaulted folder locations).
Perhaps a better approach would be something like this (although wouldn’t necessarily cover 64-bit plugs, for when that day comes!):
FileSearchPath VSTPluginFormat::getDefaultLocationsToSearch()
{
#if JUCE_MAC
return FileSearchPath ("~/Library/Audio/Plug-Ins/VST;/Library/Audio/Plug-Ins/VST");
#elif JUCE_LINUX
return FileSearchPath ("/usr/lib/vst");
#elif JUCE_WINDOWS
FileSearchPath defaultVSTPaths;
const String programFiles (File::getSpecialLocation (File::globalApplicationsDirectory).getFullPathName());
defaultVSTPaths.add (WindowsRegistry::getValue ("HKLM\\Software\\VST\\VSTPluginsPath",
programFiles + "\\Steinberg\\VstPlugins"));
defaultVSTPaths.add (WindowsRegistry::getValue ("HKLM\\Software\\VST\\VSTPluginsPath",
programFiles + "\\VstPlugins"));
defaultVSTPaths.removeNonExistentPaths();
jassert (defaultVSTPaths.getNumPaths() > 0); //There are no VST plugin folders on this machine...
return defaultVSTPaths;
#endif
}