/* * Mirai. Copyright (C) 2024 Vyn * This file is licensed under version 3 of the GNU General Public License (GPL-3.0-only) * The license can be found in the LICENSE file or at https://www.gnu.org/licenses/gpl-3.0.txt */ #include "Config.h" #include "nlohmann/json.hpp" #include #include #include #include namespace mirai { Config::Config(const std::string &path) : path_(path) { std::ifstream file(path_); configJson_ = nlohmann::json::parse(file); } std::vector Config::sources() const { std::vector sources; assert(configJson_.is_object()); assert(configJson_["files"].is_array()); auto jsonSources = configJson_["files"]; for (const auto &filePath : jsonSources) { assert(filePath.is_string()); sources.push_back(filePath.get()); } return sources; } }; // namespace mirai