| 562 | } |
| 563 | |
| 564 | void PreferencePackManager::save( |
| 565 | const std::string& name, |
| 566 | const std::string& directory, |
| 567 | const std::vector<TemplateFile>& templates |
| 568 | ) |
| 569 | { |
| 570 | if (templates.empty()) { |
| 571 | return; |
| 572 | } |
| 573 | |
| 574 | |
| 575 | // Create the config file |
| 576 | auto outputParameterManager = ParameterManager::Create(); |
| 577 | outputParameterManager->CreateDocument(); |
| 578 | for (const auto& t : templates) { |
| 579 | auto templateParameterManager = ParameterManager::Create(); |
| 580 | templateParameterManager->LoadDocument(Base::FileInfo::pathToString(t.path).c_str()); |
| 581 | copyTemplateParameters(*templateParameterManager, *outputParameterManager); |
| 582 | } |
| 583 | |
| 584 | std::string cfgFilename; |
| 585 | if (directory.empty()) { |
| 586 | AddPackToMetadata(name); |
| 587 | auto savedPreferencePacksDirectory = getSavedPreferencePacksPath(); |
| 588 | cfgFilename = Base::FileInfo::pathToString( |
| 589 | savedPreferencePacksDirectory / name / (name + ".cfg") |
| 590 | ); |
| 591 | } |
| 592 | else { |
| 593 | cfgFilename = Base::FileInfo::pathToString(fs::path(directory) / (name + ".cfg")); |
| 594 | } |
| 595 | outputParameterManager->SaveDocument(cfgFilename.c_str()); |
| 596 | } |
| 597 | |
| 598 | static std::vector<fs::path> scanForTemplateFolders(const std::string& groupName, const fs::path& entry) |
| 599 | { |
nothing calls this directly
no test coverage detected