Commit 89042fbf authored by KpChuck's avatar KpChuck

Don't throw a DecodeException if dex files aren't found but --no-src is enabled

parent fc4dcd2d
...@@ -146,7 +146,7 @@ public final class JadxDecompiler { ...@@ -146,7 +146,7 @@ public final class JadxDecompiler {
inputFiles.clear(); inputFiles.clear();
for (File file : files) { for (File file : files) {
try { try {
InputFile.addFilesFrom(file, inputFiles); InputFile.addFilesFrom(file, inputFiles, args.isSkipSources());
} catch (IOException e) { } catch (IOException e) {
throw new JadxException("Error load file: " + file, e); throw new JadxException("Error load file: " + file, e);
} }
......
...@@ -32,9 +32,9 @@ public class InputFile { ...@@ -32,9 +32,9 @@ public class InputFile {
private final File file; private final File file;
private final List<DexFile> dexFiles = new ArrayList<DexFile>(); private final List<DexFile> dexFiles = new ArrayList<DexFile>();
public static void addFilesFrom(File file, List<InputFile> list) throws IOException, DecodeException { public static void addFilesFrom(File file, List<InputFile> list, boolean... skipSources) throws IOException, DecodeException {
InputFile inputFile = new InputFile(file); InputFile inputFile = new InputFile(file);
inputFile.searchDexFiles(); inputFile.searchDexFiles(skipSources[0]);
list.add(inputFile); list.add(inputFile);
} }
...@@ -45,7 +45,7 @@ public class InputFile { ...@@ -45,7 +45,7 @@ public class InputFile {
this.file = file; this.file = file;
} }
private void searchDexFiles() throws IOException, DecodeException { private void searchDexFiles(boolean skipSources) throws IOException, DecodeException {
String fileName = file.getName(); String fileName = file.getName();
if (fileName.endsWith(".dex")) { if (fileName.endsWith(".dex")) {
...@@ -75,6 +75,8 @@ public class InputFile { ...@@ -75,6 +75,8 @@ public class InputFile {
} }
return; return;
} }
if (skipSources) return;
throw new DecodeException("Unsupported input file format: " + file); throw new DecodeException("Unsupported input file format: " + file);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment