| 562 | |
| 563 | |
| 564 | bool Manager::checkUnavailableModulesJson(json_t* rootJ) { |
| 565 | std::set<std::string> pluginModuleSlugs; |
| 566 | |
| 567 | json_t* modulesJ = json_object_get(rootJ, "modules"); |
| 568 | if (!modulesJ) |
| 569 | return false; |
| 570 | size_t moduleIndex; |
| 571 | json_t* moduleJ; |
| 572 | json_array_foreach(modulesJ, moduleIndex, moduleJ) { |
| 573 | // Get model |
| 574 | try { |
| 575 | plugin::modelFromJson(moduleJ); |
| 576 | } |
| 577 | catch (Exception& e) { |
| 578 | // Get plugin and module slugs |
| 579 | json_t* pluginSlugJ = json_object_get(moduleJ, "plugin"); |
| 580 | if (!pluginSlugJ) |
| 581 | continue; |
| 582 | std::string pluginSlug = json_string_value(pluginSlugJ); |
| 583 | |
| 584 | json_t* modelSlugJ = json_object_get(moduleJ, "model"); |
| 585 | if (!modelSlugJ) |
| 586 | continue; |
| 587 | std::string modelSlug = json_string_value(modelSlugJ); |
| 588 | |
| 589 | // Add to list |
| 590 | pluginModuleSlugs.insert(pluginSlug + "/" + modelSlug); |
| 591 | } |
| 592 | } |
| 593 | |
| 594 | if (!pluginModuleSlugs.empty()) { |
| 595 | // Ask user to open browser |
| 596 | std::string msg = string::f(string::translate("patch.unavailableModules"), string::join(pluginModuleSlugs, "\n")); |
| 597 | if (osdialog_message(OSDIALOG_WARNING, OSDIALOG_YES_NO, msg.c_str())) { |
| 598 | std::string url = "https://library.vcvrack.com/?modules="; |
| 599 | url += string::join(pluginModuleSlugs, ","); |
| 600 | system::openBrowser(url); |
| 601 | } |
| 602 | return true; |
| 603 | } |
| 604 | return false; |
| 605 | } |
| 606 | |
| 607 | |
| 608 | } // namespace patch |
nothing calls this directly
no test coverage detected