MCPcopy Create free account
hub / github.com/baldurk/renderdoc / ProcessConfig

Method ProcessConfig

renderdoc/core/settings.cpp:467–513  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

465CONFIG_SUPPORT_TYPE(rdcarray<rdcstr>)
466
467void RenderDoc::ProcessConfig()
468{
469 rdcstr confFile = FileIO::GetAppFolderFilename("renderdoc.conf");
470
471 RDCLOG("Loading config from %s", confFile.c_str());
472
473 SDObject *loadedConfig = NULL;
474 {
475 StreamReader reader(FileIO::fopen(confFile, FileIO::ReadBinary));
476
477 loadedConfig = importXMLConfig(reader);
478 }
479
480 // iterate through the current config, and update any values that are found in the loaded config.
481 // returns true if the loaded config is out of date (i.e. there's a value we have which isn't
482 // present at all, or the descriptions in the loaded config are old).
483 bool outofDate = ::MergeConfigValues(rdcstr(), m_Config, loadedConfig, false);
484
485 // in the replay application, write it back out again if it's out of date. This
486 // refreshes the config without changing any customised values and means the user can always edit
487 // the files on disk
488 if(IsReplayApp() && outofDate)
489 {
490 bool success = false;
491
492 // merge the current config into the loaded config. Values that overlap will have been updated
493 // with the user's values above, so all that's left is to add new values which aren't in the
494 // config or update descriptions
495 MergeConfigValues(rdcstr(), loadedConfig, m_Config, true);
496
497 {
498 StreamWriter writer(FileIO::fopen(confFile + ".tmp", FileIO::WriteBinary), Ownership::Stream);
499
500 exportXMLConfig(writer, loadedConfig);
501
502 // only overwrite the config if there were no errors here
503 success = !writer.IsErrored();
504 }
505
506 // if we successfully wrote the file, move it over the original
507 if(success)
508 FileIO::Move(confFile + ".tmp", confFile, true);
509 }
510
511 // delete the loaded config if we have it
512 delete loadedConfig;
513}
514
515void RenderDoc::SaveConfigSettings()
516{

Callers

nothing calls this directly

Calls 9

importXMLConfigFunction · 0.85
MergeConfigValuesFunction · 0.85
rdcstrClass · 0.85
exportXMLConfigFunction · 0.85
GetAppFolderFilenameFunction · 0.50
fopenFunction · 0.50
MoveFunction · 0.50
c_strMethod · 0.45
IsErroredMethod · 0.45

Tested by

no test coverage detected