| 243 | } |
| 244 | |
| 245 | void ::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 | |
| 267 | void ::Cli::writeConfigFile() |
| 268 | { |
nothing calls this directly
no test coverage detected