| 297 | } |
| 298 | |
| 299 | static ConfigProto loadSingleConfigFile(std::string filename) |
| 300 | { |
| 301 | const auto& it = formats.find(filename); |
| 302 | if (it != formats.end()) |
| 303 | return *it->second; |
| 304 | else |
| 305 | { |
| 306 | std::ifstream f(filename, std::ios::out); |
| 307 | if (f.fail()) |
| 308 | error("Cannot open '{}': {}", filename, strerror(errno)); |
| 309 | |
| 310 | std::ostringstream ss; |
| 311 | ss << f.rdbuf(); |
| 312 | |
| 313 | ConfigProto config; |
| 314 | if (!google::protobuf::TextFormat::MergeFromString(ss.str(), &config)) |
| 315 | error("couldn't load external config proto"); |
| 316 | return config; |
| 317 | } |
| 318 | } |
| 319 | |
| 320 | void Config::readBaseConfigFile(std::string filename) |
| 321 | { |
no test coverage detected