Commit c3c437da authored by Dominik Charousset's avatar Dominik Charousset

Fix merging content of INI files into the config

parent 0ee541d7
...@@ -169,8 +169,13 @@ void ini_consumer::key(std::string name) { ...@@ -169,8 +169,13 @@ void ini_consumer::key(std::string name) {
void ini_consumer::value_impl(config_value&& x) { void ini_consumer::value_impl(config_value&& x) {
auto dict = get_if<config_value::dictionary>(&x); auto dict = get_if<config_value::dictionary>(&x);
if (dict != nullptr && !dict->empty()) if (dict != nullptr && !dict->empty()) {
cfg_.emplace(std::move(current_key), std::move(*dict)); // We need to "merge" values into the destination, because it can already
// contain any number of unrelated entries.
auto& dst = cfg_[current_key];
for (auto& entry : *dict)
dst.insert_or_assign(entry.first, std::move(entry.second));
}
} }
} // namespace detail } // namespace detail
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment