Changeset View
Changeset View
Standalone View
Standalone View
src/util/system.cpp
Show First 20 Lines • Show All 450 Lines • ▼ Show 20 Lines | bool ArgsManager::ReadSettingsFile(std::vector<std::string> *errors) { | ||||
LOCK(cs_args); | LOCK(cs_args); | ||||
m_settings.rw_settings.clear(); | m_settings.rw_settings.clear(); | ||||
std::vector<std::string> read_errors; | std::vector<std::string> read_errors; | ||||
if (!util::ReadSettings(path, m_settings.rw_settings, read_errors)) { | if (!util::ReadSettings(path, m_settings.rw_settings, read_errors)) { | ||||
SaveErrors(read_errors, errors); | SaveErrors(read_errors, errors); | ||||
return false; | return false; | ||||
} | } | ||||
for (const auto &setting : m_settings.rw_settings) { | |||||
std::string section; | |||||
std::string key = setting.first; | |||||
// Split setting key into section and argname | |||||
(void)InterpretOption(section, key, /* value */ {}); | |||||
if (!GetArgFlags('-' + key)) { | |||||
LogPrintf("Ignoring unknown rw_settings value %s\n", setting.first); | |||||
} | |||||
} | |||||
return true; | return true; | ||||
} | } | ||||
bool ArgsManager::WriteSettingsFile(std::vector<std::string> *errors) const { | bool ArgsManager::WriteSettingsFile(std::vector<std::string> *errors) const { | ||||
fs::path path, path_tmp; | fs::path path, path_tmp; | ||||
if (!GetSettingsPath(&path, /* temp= */ false) || | if (!GetSettingsPath(&path, /* temp= */ false) || | ||||
!GetSettingsPath(&path_tmp, /* temp= */ true)) { | !GetSettingsPath(&path_tmp, /* temp= */ true)) { | ||||
throw std::logic_error("Attempt to write settings file when dynamic " | throw std::logic_error("Attempt to write settings file when dynamic " | ||||
▲ Show 20 Lines • Show All 935 Lines • Show Last 20 Lines |