MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / WriteSettingsFile

Method WriteSettingsFile

src/common/args.cpp:487–505  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

485}
486
487bool ArgsManager::WriteSettingsFile(std::vector<std::string>* errors, bool backup) const
488{
489 fs::path path, path_tmp;
490 if (!GetSettingsPath(&path, /*temp=*/false, backup) || !GetSettingsPath(&path_tmp, /*temp=*/true, backup)) {
491 throw std::logic_error("Attempt to write settings file when dynamic settings are disabled.");
492 }
493
494 LOCK(cs_args);
495 std::vector<std::string> write_errors;
496 if (!common::WriteSettings(path_tmp, m_settings.rw_settings, write_errors)) {
497 SaveErrors(write_errors, errors);
498 return false;
499 }
500 if (!RenameOver(path_tmp, path)) {
501 SaveErrors({strprintf("Failed renaming settings file %s to %s\n", fs::PathToString(path_tmp), fs::PathToString(path))}, errors);
502 return false;
503 }
504 return true;
505}
506
507common::SettingsValue ArgsManager::GetPersistentSetting(const std::string& name) const
508{

Callers 6

BOOST_AUTO_TEST_CASEFunction · 0.80
integerGetArgBugMethod · 0.80
InitConfigFunction · 0.80
updateRwSettingMethod · 0.80
resetSettingsMethod · 0.80
updateRwSettingMethod · 0.80

Calls 4

WriteSettingsFunction · 0.85
SaveErrorsFunction · 0.85
RenameOverFunction · 0.85
PathToStringFunction · 0.85

Tested by 2

BOOST_AUTO_TEST_CASEFunction · 0.64
integerGetArgBugMethod · 0.64