Cavoke  1.1.0
A Platform for creating and hosting multiplayer turn-based board games
Loading...
Searching...
No Matches
games_storage_config.cpp
1#include "games_storage_config.h"
2#include <boost/filesystem.hpp>
3#include <iostream>
4
5namespace cavoke::server::model {
6
7GamesStorageConfig GamesStorageConfig::load(const std::string &config_file) {
8 if (!boost::filesystem::exists(config_file) ||
9 !boost::filesystem::is_regular_file(config_file)) { // FIXME
10 throw std::invalid_argument(
11 "No such game storage configuration file: " + config_file);
12 }
13
14 std::ifstream file(config_file);
15 json j = json::parse(file);
16 return j.get<GamesStorageConfig>();
17}
18
19} // namespace cavoke::server::model