MCPcopy Create free account
hub / github.com/REGoth-project/REGoth / loadConfigFile

Method loadConfigFile

src/utils/cli.cpp:245–265  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

243}
244
245void ::Cli::loadConfigFile()
246{
247 std::string conf = Utils::getUserDataLocation() + "/" + CONFIG_FILE;
248
249 // Have we even written one yet?
250 if (Utils::fileExists(conf))
251 {
252 std::string contents = Utils::readFileContents(conf);
253
254 // Strip all comments since the json-parser doesn't support them
255 std::string cleaned = Utils::stripJsonComments(contents);
256
257 if (cleaned.empty())
258 return; // Guess that's not valid
259
260 json j = json::parse(cleaned);
261
262 for (Flag* f : Global::getFlagList())
263 f->readFromConfig(j);
264 }
265}
266
267void ::Cli::writeConfigFile()
268{

Callers

nothing calls this directly

Calls 2

readFromConfigMethod · 0.80
emptyMethod · 0.45

Tested by

no test coverage detected