MCPcopy Create free account
hub / github.com/ElementsProject/elements / WriteSettings

Function WriteSettings

src/util/settings.cpp:107–124  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

105}
106
107bool 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
126SettingsValue GetSetting(const Settings& settings,
127 const std::string& section,

Callers 2

WriteMethod · 0.85
WriteSettingsFileMethod · 0.85

Calls 6

PathToStringFunction · 0.85
__pushKVMethod · 0.80
emplace_backMethod · 0.80
openMethod · 0.45
writeMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected