Update iterator and merge rid/non-rid assets
This commit is contained in:
parent
2ce679c57d
commit
967fc370a0
1 changed files with 26 additions and 7 deletions
|
@ -139,9 +139,14 @@ bool deps_json_t::perform_rid_fallback(rid_specific_assets_t* portable_assets, c
|
|||
assert(!matched_rid.empty());
|
||||
for (auto iter = package.second.begin(); iter != package.second.end(); /* */)
|
||||
{
|
||||
iter = (iter->first != matched_rid)
|
||||
? package.second.erase(iter)
|
||||
: iter++;
|
||||
if (iter->first != matched_rid)
|
||||
{
|
||||
iter = package.second.erase(iter);
|
||||
}
|
||||
else
|
||||
{
|
||||
++iter;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
@ -221,13 +226,27 @@ bool deps_json_t::load_portable(const json_value& json, const pal::string_t& tar
|
|||
return false;
|
||||
}
|
||||
|
||||
std::vector<pal::string_t> merged;
|
||||
auto package_exists = [&rid_assets, &non_rid_assets](const pal::string_t& package) -> bool {
|
||||
return rid_assets.count(package) || non_rid_assets.count(package);
|
||||
};
|
||||
auto get_relpaths = [&rid_assets, &non_rid_assets](const pal::string_t& package, int type_index) -> const std::vector<pal::string_t>& {
|
||||
return (rid_assets.count(package))
|
||||
? rid_assets[package].begin()->second[type_index]
|
||||
: non_rid_assets[package][type_index];
|
||||
auto get_relpaths = [&rid_assets, &non_rid_assets, &merged](const pal::string_t& package, int type_index) -> const std::vector<pal::string_t>& {
|
||||
if (rid_assets.count(package) && non_rid_assets.count(package))
|
||||
{
|
||||
const std::vector<pal::string_t>& rel1 = rid_assets[package].begin()->second[type_index];
|
||||
const std::vector<pal::string_t>& rel2 = non_rid_assets[package][type_index];
|
||||
merged.clear();
|
||||
merged.reserve(rel1.size() + rel2.size());
|
||||
merged.insert(merged.end(), rel1.begin(), rel1.end());
|
||||
merged.insert(merged.end(), rel2.begin(), rel2.end());
|
||||
return merged;
|
||||
}
|
||||
else
|
||||
{
|
||||
return rid_assets.count(package)
|
||||
? rid_assets[package].begin()->second[type_index]
|
||||
: non_rid_assets[package][type_index];
|
||||
}
|
||||
};
|
||||
|
||||
reconcile_libraries_with_targets(json, package_exists, get_relpaths);
|
||||
|
|
Loading…
Reference in a new issue