The config now prints a way better error message if you give it a bad file to use.
This commit is contained in:
parent
dc8648016d
commit
e45de2a2cf
1 changed files with 4 additions and 1 deletions
|
@ -8,7 +8,10 @@ using fmt::format;
|
||||||
std::filesystem::path Config::BASE_DIR{"."};
|
std::filesystem::path Config::BASE_DIR{"."};
|
||||||
|
|
||||||
Config::Config(const std::string src_path) : $src_path(src_path) {
|
Config::Config(const std::string src_path) : $src_path(src_path) {
|
||||||
std::ifstream infile(Config::path_to($src_path));
|
auto path_to = Config::path_to($src_path);
|
||||||
|
dbc::check(std::filesystem::exists(path_to),
|
||||||
|
fmt::format("requested config file {} doesn't exist", path_to.string()));
|
||||||
|
std::ifstream infile(path_to);
|
||||||
$config = json::parse(infile);
|
$config = json::parse(infile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue