MCPcopy Create free account
hub / github.com/Kitware/ParaView / LoadSettings

Method LoadSettings

Remoting/Application/vtkInitializationHelper.cxx:616–659  ·  view source on GitHub ↗

----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

614
615//----------------------------------------------------------------------------
616void vtkInitializationHelper::LoadSettings()
617{
618 if (vtkInitializationHelper::LoadSettingsFilesDuringInitialization == false)
619 {
620 return;
621 }
622
623 vtkProcessModule* pm = vtkProcessModule::GetProcessModule();
624 assert(pm != nullptr);
625 int myRank = pm->GetPartitionId();
626
627 vtkSMSettings* settings = vtkSMSettings::GetInstance();
628 if (myRank > 0) // don't read files on satellites.
629 {
630 settings->DistributeSettings();
631 return;
632 }
633
634 // Load user-level settings
635 std::string userSettingsFilePath = vtkPVStandardPaths::GetUserSettingsFilePath();
636 if (!settings->AddCollectionFromFile(userSettingsFilePath, vtkSMSettings::GetUserPriority()))
637 {
638 // Loading user settings failed, so we need to create an empty
639 // collection with highest priority manually. Otherwise, if a
640 // setting is changed, a lower-priority collection such as site
641 // settings may receive the modified setting values.
642 settings->AddCollectionFromString("{}", vtkSMSettings::GetUserPriority());
643 }
644
645 // Load site-level settings
646 const std::vector<std::string> pathsToSearch = vtkPVStandardPaths::GetInstallDirectories();
647 const std::string filename = vtkInitializationHelper::GetApplicationName() + "-SiteSettings.json";
648 for (const std::string& path : pathsToSearch)
649 {
650 const std::string siteSettingsFile = std::string(path).append("/").append(filename);
651 if (settings->AddCollectionFromFile(siteSettingsFile, 1.0))
652 {
653 break;
654 }
655 }
656 settings->DistributeSettings();
657
658 vtkInitializationHelper::SaveUserSettingsFileDuringFinalization = true;
659}
660
661//----------------------------------------------------------------------------
662void vtkInitializationHelper::PrintSelf(ostream& os, vtkIndent indent)

Callers

nothing calls this directly

Calls 7

GetUserSettingsFilePathFunction · 0.85
GetInstallDirectoriesFunction · 0.85
GetPartitionIdMethod · 0.80
DistributeSettingsMethod · 0.80
AddCollectionFromFileMethod · 0.80
appendMethod · 0.45

Tested by

no test coverage detected