MCPcopy Create free account
hub / github.com/KTH-RPL/dufomap / readConfig

Function readConfig

src/dufomap.cpp:239–271  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

237}
238
239Config readConfig(std::filesystem::path path)
240{
241 Config config;
242 for (;;) {
243 if (std::filesystem::exists(path)) {
244 toml::table tbl;
245 try {
246 tbl = toml::parse_file((path).string());
247 } catch (toml::parse_error const& err) {
248 std::cerr << "Configuration parsing failed:\n" << err << '\n';
249 exit(1);
250 }
251
252 config.read(tbl);
253 if (config.printing.verbose) {
254 std::cout << "Found: " << (path) << '\n';
255 }
256
257 break;
258 }
259 if (!path.has_parent_path()) {
260 std::cout << "Did not find configuration file, using default.\n";
261 break;
262 }
263 path = path.parent_path();
264 }
265
266 if (config.printing.verbose) {
267 std::cout << config << '\n';
268 }
269
270 return config;
271}
272
273ufo::Color randomColor()
274{

Callers 1

mainFunction · 0.85

Calls 3

parse_fileFunction · 0.85
stringMethod · 0.80
readMethod · 0.80

Tested by

no test coverage detected