MCPcopy Create free account
hub / github.com/FreeCAD/FreeCAD / save

Method save

src/Gui/PreferencePackManager.cpp:564–596  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

562}
563
564void 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
598static std::vector<fs::path> scanForTemplateFolders(const std::string& groupName, const fs::path& entry)
599{

Callers

nothing calls this directly

Calls 7

copyTemplateParametersFunction · 0.85
CreateDocumentMethod · 0.80
LoadDocumentMethod · 0.80
SaveDocumentMethod · 0.80
CreateFunction · 0.50
emptyMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected