| 485 | } |
| 486 | |
| 487 | bool 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 | |
| 507 | common::SettingsValue ArgsManager::GetPersistentSetting(const std::string& name) const |
| 508 | { |