| 105 | } |
| 106 | |
| 107 | bool WriteSettings(const fs::path& path, |
| 108 | const std::map<std::string, SettingsValue>& values, |
| 109 | std::vector<std::string>& errors) |
| 110 | { |
| 111 | SettingsValue out(SettingsValue::VOBJ); |
| 112 | for (const auto& value : values) { |
| 113 | out.__pushKV(value.first, value.second); |
| 114 | } |
| 115 | std::ofstream file; |
| 116 | file.open(path); |
| 117 | if (file.fail()) { |
| 118 | errors.emplace_back(strprintf("Error: Unable to open settings file %s for writing", fs::PathToString(path))); |
| 119 | return false; |
| 120 | } |
| 121 | file << out.write(/* prettyIndent= */ 4, /* indentLevel= */ 1) << std::endl; |
| 122 | file.close(); |
| 123 | return true; |
| 124 | } |
| 125 | |
| 126 | SettingsValue GetSetting(const Settings& settings, |
| 127 | const std::string& section, |
no test coverage detected