| 462 | } |
| 463 | |
| 464 | command_result FilterManager::saveConfig(DFHack::color_ostream& out) const noexcept |
| 465 | { |
| 466 | try { |
| 467 | DEBUG(command, out) << "Save config to '" << configPath << "'" << std::endl; |
| 468 | JsonArchive archive; |
| 469 | save(archive); |
| 470 | std::ofstream ofs(configPath); |
| 471 | if (!ofs.good()) |
| 472 | throw std::runtime_error{"Failed to open configuration file for writing"}; |
| 473 | ofs << archive; |
| 474 | } catch(std::exception & e) { |
| 475 | ERR(command, out) << "Serializing filters to '" << configPath << "' failed: " |
| 476 | << e.what() << std::endl; |
| 477 | return CR_FAILURE; |
| 478 | } |
| 479 | return CR_OK; |
| 480 | } |
| 481 | |
| 482 | void FilterManager::connectTo(DebugManager::categorySignal_t& signal) noexcept |
| 483 | { |
no test coverage detected