| 533 | } |
| 534 | |
| 535 | bool 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 | } |
nothing calls this directly
no test coverage detected