summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJay Freeman (saurik) <saurik@saurik.com>2016-07-27 21:39:23 -0700
committerJay Freeman (saurik) <saurik@saurik.com>2016-07-27 22:00:47 -0700
commit35229d065ce164cc3d8a3b37446f27c9d85deddc (patch)
tree256ea97ddf9d9b5f145e87f11c1daf282bc871a4
parente4d33eecb0efe964cd83637ab57f25122b13d1e5 (diff)
downloadldid-35229d065ce164cc3d8a3b37446f27c9d85deddc.tar.gz
ldid-35229d065ce164cc3d8a3b37446f27c9d85deddc.tar.zst
ldid-35229d065ce164cc3d8a3b37446f27c9d85deddc.zip
UnionFolder clobbered sub-paths in nested bundles.
-rw-r--r--ldid.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/ldid.cpp b/ldid.cpp
index 14d1cef..4ac0012 100644
--- a/ldid.cpp
+++ b/ldid.cpp
@@ -1703,17 +1703,18 @@ bool UnionFolder::Open(const std::string &path, const Functor<void (std::streamb
void UnionFolder::Find(const std::string &path, const Functor<void (const std::string &, const Functor<void (const Functor<void (std::streambuf &, std::streambuf &)> &)> &)> &code) {
parent_.Find(path, fun([&](const std::string &name, const Functor<void (const Functor<void (std::streambuf &, std::streambuf &)> &)> &save) {
- if (files_.find(name) == files_.end())
+ if (files_.find(path + name) == files_.end())
code(name, save);
}));
for (auto &file : files_)
- code(file.first, fun([&](const Functor<void (std::streambuf &, std::streambuf &)> &code) {
- parent_.Save(file.first, fun([&](std::streambuf &save) {
- file.second.pubseekpos(0, std::ios::in);
- code(file.second, save);
+ if (file.first.size() >= path.size() && file.first.substr(0, path.size()) == path)
+ code(file.first.substr(path.size()), fun([&](const Functor<void (std::streambuf &, std::streambuf &)> &code) {
+ parent_.Save(file.first, fun([&](std::streambuf &save) {
+ file.second.pubseekpos(0, std::ios::in);
+ code(file.second, save);
+ }));
}));
- }));
}
#ifndef LDID_NOTOOLS