summaryrefslogtreecommitdiff
path: root/libs/androidfw/ApkAssets.cpp
diff options
context:
space:
mode:
authorAdam Lesinski <adamlesinski@google.com>2018-02-09 11:01:26 -0800
committerAdam Lesinski <adamlesinski@google.com>2018-02-09 12:43:04 -0800
commitec7f06cc372a7298c85bf96cb4133d7dc8807419 (patch)
treed891b4dd7c17b0ade4017d76ec5285ed1ba00265 /libs/androidfw/ApkAssets.cpp
parent3160c8b0f792d2153f020fe810290ddf8d61b15c (diff)
Revert "AssetManager2: Fix list function"
This reverts commit adc0b87ec235a71d722fb8d6aad50ceaeac8c6d5. Bug:73134570 Change-Id: I9e652245e7661eb7a34dadb5f363a08bc8c9e57e
Diffstat (limited to 'libs/androidfw/ApkAssets.cpp')
-rw-r--r--libs/androidfw/ApkAssets.cpp16
1 files changed, 6 insertions, 10 deletions
diff --git a/libs/androidfw/ApkAssets.cpp b/libs/androidfw/ApkAssets.cpp
index 60f8a1833919..da0205d72125 100644
--- a/libs/androidfw/ApkAssets.cpp
+++ b/libs/androidfw/ApkAssets.cpp
@@ -231,16 +231,12 @@ bool ApkAssets::ForEachFile(const std::string& root_path,
while ((result = ::Next(cookie, &entry, &name)) == 0) {
StringPiece full_file_path(reinterpret_cast<const char*>(name.name), name.name_length);
StringPiece leaf_file_path = full_file_path.substr(root_path_full.size());
-
- if (!leaf_file_path.empty()) {
- auto iter = std::find(leaf_file_path.begin(), leaf_file_path.end(), '/');
- if (iter != leaf_file_path.end()) {
- std::string dir =
- leaf_file_path.substr(0, std::distance(leaf_file_path.begin(), iter)).to_string();
- dirs.insert(std::move(dir));
- } else {
- f(leaf_file_path, kFileTypeRegular);
- }
+ auto iter = std::find(leaf_file_path.begin(), leaf_file_path.end(), '/');
+ if (iter != leaf_file_path.end()) {
+ dirs.insert(
+ leaf_file_path.substr(0, std::distance(leaf_file_path.begin(), iter)).to_string());
+ } else if (!leaf_file_path.empty()) {
+ f(leaf_file_path, kFileTypeRegular);
}
}
::EndIteration(cookie);