PluginScanner Missing one Plugin

This routine is working fine except for the fact that it’s missing one plugin.

while (scanner->scanNextFile(true, plugin))

{
    juce::File file = plugin;

    auto plugin_name = file.getFileNameWithoutExtension();

    //   listbox.addPlugin(plugin_name);

    pluginlist.add(plugin_name);

   // listbox.addPlugin(plugin_name);

    tracker.addPlugin(plugin);

}

private:

juce::VST3PluginFormat pluginFormat;

std::unique_ptr<juce::PluginDirectoryScanner> scanner;

juce::KnownPluginList knownPluginList;

juce::FileSearchPath searchPath = "C:\\Program Files\\Common Files\\VST3";

I can’t seem to find the bug.

Tried:

while (scanner->scanNextFile(false, plugin))

… ?

I tried that it doesn’t work, all plugins are .VST3

Does anyone have a scanner that works?

Maybe the sources for pluginval can provide enlightenment:

   do
   {
      

       descriptions.clear();

       juce::String nextPluginFile = scanner->getNextPluginFileThatWillBeScanned();
       juce::OwnedArray<juce::PluginDescription> descriptions;
       knownPluginList.scanAndAddFile(nextPluginFile, true, descriptions, pluginFormat);

} while (doScan());

bool doScan()
{
    if (scanner->scanNextFile(true, plugin))
        return true;
}

This is what I came up with, it solves the missing one plugin.

This is OT, but you can simplify your code by just doing this:

do
{
   ...
} while (scanner->scanNextFile(true, plugin));

Your doScan() function is missing a return statement at the end, which is undefined behaviour!