MCPcopy Create free account
hub / github.com/DFHack/dfhack / loadConfig

Method loadConfig

plugins/debug.cpp:443–462  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

441}
442
443command_result FilterManager::loadConfig(DFHack::color_ostream& out) noexcept
444{
445 nextId_ = 1;
446 if (!Filesystem::isfile(configPath))
447 return CR_OK;
448 try {
449 DEBUG(command, out) << "Load config from '" << configPath << "'" << std::endl;
450 JsonArchive archive;
451 std::ifstream ifs(configPath);
452 if (!ifs.good())
453 throw std::runtime_error{"Failed to open configuration file for reading"};
454 ifs >> archive;
455 load(archive);
456 } catch(std::exception& e) {
457 ERR(command, out) << "Serializing filters from '" << configPath << "' failed: "
458 << e.what() << std::endl;
459 return CR_FAILURE;
460 }
461 return CR_OK;
462}
463
464command_result FilterManager::saveConfig(DFHack::color_ostream& out) const noexcept
465{

Callers 1

Calls 1

whatMethod · 0.45

Tested by

no test coverage detected