diff options
author | Aqua-sama <aqua@iserlohn-fortress.net> | 2019-11-17 10:35:14 +0200 |
---|---|---|
committer | Aqua-sama <aqua@iserlohn-fortress.net> | 2019-11-17 10:35:14 +0200 |
commit | 315396cbf77995ac2d24ee6cbd714751530757bc (patch) | |
tree | c5c4e3510276b77557c36be7e94f8ae65f708733 /src | |
parent | Bookmarks: move xbel implementation to formats/ (diff) | |
download | smolbote-315396cbf77995ac2d24ee6cbd714751530757bc.tar.xz |
Configuration: only try reading it when cfg file can be opened
Diffstat (limited to 'src')
-rw-r--r-- | src/conf.hpp.in | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/conf.hpp.in b/src/conf.hpp.in index f509eb2..ed97730 100644 --- a/src/conf.hpp.in +++ b/src/conf.hpp.in @@ -17,16 +17,17 @@ inline void init_conf(const std::string &path) { - std::fstream fs; - fs.open(path, std::fstream::in); - assert(fs.is_open()); - auto value_map = std::make_unique<Configuration, std::initializer_list<std::pair<std::string, conf_value_t>>>({ @conf_init_list@ }); - value_map->read(fs); + + std::fstream fs; + fs.open(path, std::fstream::in); + if(fs.is_open()) { + value_map->read(fs); + fs.close(); + } Configuration::move_global(std::move(value_map)); - fs.close(); } |