Skip to content

Commit

Permalink
Sort files list in FileDirectory::loadAll() (#3657)
Browse files Browse the repository at this point in the history
This lets us assemble classes.dex in a reproducible manner.

Test:
  apktool d test.apk > /dev/null
  apktool b test > /dev/null
  sha1sum test/build/apk/classes.dex
  apktool -f d test.apk > /dev/null
  apktool b test > /dev/null
  sha1sum test/build/apk/classes.dex
  • Loading branch information
luk1337 authored Aug 12, 2024
1 parent 7ad1c9f commit 9ebd579
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions brut.j.dir/src/main/java/brut/directory/FileDirectory.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

import java.io.*;
import java.net.URLDecoder;
import java.util.Arrays;
import java.util.Comparator;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;

Expand Down Expand Up @@ -107,6 +109,8 @@ private void loadAll() {
mDirs = new LinkedHashMap<>();

File[] files = getDir().listFiles();
Arrays.sort(files, Comparator.comparing(f -> f.getName()));

for (File file : files) {
if (file.isFile()) {
mFiles.add(file.getName());
Expand Down

0 comments on commit 9ebd579

Please sign in to comment.