summaryrefslogtreecommitdiff
path: root/tools/aapt2/io/FileSystem.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/aapt2/io/FileSystem.cpp')
-rw-r--r--tools/aapt2/io/FileSystem.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/tools/aapt2/io/FileSystem.cpp b/tools/aapt2/io/FileSystem.cpp
index 51cc9032fb3e..e15f935cad27 100644
--- a/tools/aapt2/io/FileSystem.cpp
+++ b/tools/aapt2/io/FileSystem.cpp
@@ -79,6 +79,7 @@ std::unique_ptr<FileCollection> FileCollection::Create(const android::StringPiec
return nullptr;
}
+ std::vector<std::string> sorted_files;
while (struct dirent *entry = readdir(d.get())) {
std::string prefix_path = root.to_string();
file::AppendPath(&prefix_path, entry->d_name);
@@ -105,10 +106,15 @@ std::unique_ptr<FileCollection> FileCollection::Create(const android::StringPiec
continue;
}
- collection->InsertFile(full_path);
+ sorted_files.push_back(full_path);
}
}
+ std::sort(sorted_files.begin(), sorted_files.end());
+ for (const std::string& full_path : sorted_files) {
+ collection->InsertFile(full_path);
+ }
+
return collection;
}