Commit ebd7c0e3 authored by Cory Quammen's avatar Cory Quammen

Try to load site settings files and use return value in search logic

Now instead of checking whether a settings file exists before
attempting to load it, we just try to load it and use the return code
from vtkSMSettings::AddCollectionFromString() to determine whether to
search other locations. This required fixing some of the behavior of
vtkSMSetting::AddCollectionFromFile() when the given file couldn't be
loaded.

Change-Id: Ic4f1caea33454453a4c7049c10642148a91f9cad
parent c7f463ea
......@@ -919,10 +919,7 @@ bool vtkSMSettings::AddCollectionFromFile(const std::string & fileName,
else
{
vtkSMSettingsDebugMacro("Could not open settings file '" << fileName << "'");
// Shouldn't this return false?
std::string emptyString;
return this->AddCollectionFromString(emptyString, priority);
return false;
}
}
......
......@@ -344,23 +344,15 @@ void vtkInitializationHelper::LoadSettings()
std::string filename = vtkInitializationHelper::GetApplicationName() + "-SiteSettings.json";
std::string siteSettingsFile;
bool settingsFileFound = false;
for (size_t cc = 0; cc < pathsToSearch.size(); cc++)
{
std::string path = pathsToSearch[cc];
siteSettingsFile = path + "/" + filename;
if (vtksys::SystemTools::FileExists(siteSettingsFile.c_str(), true))
if (settings->AddCollectionFromFile(siteSettingsFile, 1.0))
{
settingsFileFound = true;
break;
}
}
if (settingsFileFound)
{
settings->AddCollectionFromFile(siteSettingsFile, 1.0);
}
settings->DistributeSettings();
vtkInitializationHelper::SaveUserSettingsFileDuringFinalization = true;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment