| 532 | } |
| 533 | |
| 534 | void PluginManager::Load() |
| 535 | { |
| 536 | // Create/Open the registry |
| 537 | auto pRegistry = sFactory(FileNames::PluginRegistry()); |
| 538 | auto ®istry = *pRegistry; |
| 539 | |
| 540 | // If this group doesn't exist then we have something that's not a registry. |
| 541 | // We should probably warn the user, but it's pretty unlikely that this will happen. |
| 542 | if (!registry.HasGroup(REGROOT)) |
| 543 | { |
| 544 | // Must start over |
| 545 | // This DeleteAll affects pluginregistry.cfg only, not audacity.cfg |
| 546 | // That is, the memory of on/off states of effect (and generator, |
| 547 | // analyzer, and tool) plug-ins |
| 548 | registry.Clear(); |
| 549 | registry.Flush(); |
| 550 | return; |
| 551 | } |
| 552 | |
| 553 | // Check for a registry version that we can understand |
| 554 | // TODO: Should also check for a registry file that is newer than |
| 555 | // what we can understand. |
| 556 | mRegver = registry.Read(REGVERKEY); |
| 557 | if (Regver_lt(mRegver, "1.1")) { |
| 558 | // Conversion code here, for when registry version changes. |
| 559 | |
| 560 | // We iterate through the effects, possibly updating their info. |
| 561 | wxString group = GetPluginTypeString(PluginTypeEffect); |
| 562 | wxString cfgPath = REGROOT + group + wxCONFIG_PATH_SEPARATOR; |
| 563 | wxArrayString groupsToDelete; |
| 564 | |
| 565 | auto cfgGroup = registry.BeginGroup(cfgPath); |
| 566 | for(const auto& groupName : registry.GetChildGroups()) |
| 567 | { |
| 568 | auto effectGroup = registry.BeginGroup(groupName); |
| 569 | wxString effectSymbol = registry.Read(KEY_SYMBOL, ""); |
| 570 | wxString effectVersion = registry.Read(KEY_VERSION, ""); |
| 571 | |
| 572 | |
| 573 | // For 2.3.0 the plugins we distribute have moved around. |
| 574 | // So we upped the registry version number to 1.1. |
| 575 | // These particular config edits were originally written to fix Bug 1914. |
| 576 | if (Regver_le(mRegver, "1.0")) { |
| 577 | // Nyquist prompt is a built-in that has moved to the tools menu. |
| 578 | if (effectSymbol == NYQUIST_PROMPT_ID) { |
| 579 | registry.Write(KEY_EFFECTTYPE, "Tool"); |
| 580 | // Old version of SDE was in Analyze menu. Now it is in Tools. |
| 581 | // We don't want both the old and the new. |
| 582 | } else if ((effectSymbol == "Sample Data Export") && (effectVersion == "n/a")) { |
| 583 | groupsToDelete.push_back(cfgPath + groupName); |
| 584 | // Old version of SDI was in Generate menu. Now it is in Tools. |
| 585 | } else if ((effectSymbol == "Sample Data Import") && (effectVersion == "n/a")) { |
| 586 | groupsToDelete.push_back(cfgPath + groupName); |
| 587 | } |
| 588 | } |
| 589 | } |
| 590 | // Doing the deletion within the search loop risked skipping some items, |
| 591 | // hence the delayed delete. |
nothing calls this directly
no test coverage detected