MCPcopy Create free account
hub / github.com/apohl79/audiogridder / scanPlugin

Method scanPlugin

Server/Source/Server.cpp:535–690  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

533}
534
535bool Server::scanPlugin(const String& id, const String& format, int srvId, bool secondRun) {
536 std::unique_ptr<AudioPluginFormat> fmt;
537 if (!format.compare("VST")) {
538#if JUCE_PLUGINHOST_VST
539 fmt = std::make_unique<VSTPluginFormat>();
540#else
541 return false;
542#endif
543 } else if (!format.compare("VST3")) {
544 fmt = std::make_unique<VST3PluginFormat>();
545#if JUCE_MAC
546 } else if (!format.compare("AudioUnit")) {
547 fmt = std::make_unique<AudioUnitPluginFormat>();
548#endif
549 } else {
550 return false;
551 }
552
553 setLogTagStatic("server");
554 logln("scanning id=" << id << " fmt=" << format << " srvId=" << srvId);
555
556 KnownPluginList plist, newlist;
557 json playouts;
558 loadKnownPluginList(plist, playouts, srvId);
559
560 File crashFile(Defaults::getConfigFileName(Defaults::ConfigDeadMan, {{"id", String(srvId)}}));
561 File errFile(Defaults::getConfigFileName(Defaults::ScanError, {{"id", String(srvId)}}));
562 File errFileLayout(Defaults::getConfigFileName(Defaults::ScanLayoutError, {{"id", String(srvId)}}));
563
564 if (crashFile.existsAsFile()) {
565 crashFile.deleteFile();
566 }
567
568 if (errFileLayout.existsAsFile()) {
569 errFileLayout.deleteFile();
570 }
571
572 errFile.create();
573
574 logln("starting scan...");
575
576 int retries = 4;
577 bool success = false;
578 String name;
579
580 do {
581 PluginDirectoryScanner scanner(newlist, *fmt, {}, true, crashFile);
582 scanner.setFilesOrIdentifiersToScan({id});
583 scanner.scanNextFile(true, name);
584
585 if (scanner.getFailedFiles().isEmpty()) {
586 success = true;
587 } else {
588 if (retries == 0) {
589 for (auto& f : scanner.getFailedFiles()) {
590 plist.addToBlacklist(f);
591 }
592 }

Callers

nothing calls this directly

Calls 10

getConfigFileNameFunction · 0.85
describeLayoutFunction · 0.85
serializeLayoutFunction · 0.85
deleteFileMethod · 0.80
isOpenMethod · 0.80
writeMethod · 0.80
push_backMethod · 0.80
createMethod · 0.45
sizeMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected