mirror of
https://github.com/moparisthebest/fernflower
synced 2024-11-22 17:22:18 -05:00
java-decompiler: check for non-existent files
This commit is contained in:
parent
89b40fd28a
commit
1fde78b6f1
@ -42,8 +42,8 @@ public class ConsoleDecompiler implements IBytecodeProvider, IResultSaver {
|
||||
}
|
||||
|
||||
Map<String, Object> mapOptions = new HashMap<String, Object>();
|
||||
List<String> lstSources = new ArrayList<String>();
|
||||
List<String> lstLibraries = new ArrayList<String>();
|
||||
List<File> lstSources = new ArrayList<File>();
|
||||
List<File> lstLibraries = new ArrayList<File>();
|
||||
|
||||
boolean isOption = true;
|
||||
for (int i = 0; i < args.length - 1; ++i) { // last parameter - destination
|
||||
@ -65,10 +65,10 @@ public class ConsoleDecompiler implements IBytecodeProvider, IResultSaver {
|
||||
isOption = false;
|
||||
|
||||
if (arg.startsWith("-e=")) {
|
||||
lstLibraries.add(arg.substring(3));
|
||||
addPath(lstLibraries, arg.substring(3));
|
||||
}
|
||||
else {
|
||||
lstSources.add(arg);
|
||||
addPath(lstSources, arg);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -87,16 +87,27 @@ public class ConsoleDecompiler implements IBytecodeProvider, IResultSaver {
|
||||
PrintStreamLogger logger = new PrintStreamLogger(System.out);
|
||||
ConsoleDecompiler decompiler = new ConsoleDecompiler(destination, mapOptions, logger);
|
||||
|
||||
for (String source : lstSources) {
|
||||
decompiler.addSpace(new File(source), true);
|
||||
for (File source : lstSources) {
|
||||
decompiler.addSpace(source, true);
|
||||
}
|
||||
for (String library : lstLibraries) {
|
||||
decompiler.addSpace(new File(library), false);
|
||||
for (File library : lstLibraries) {
|
||||
decompiler.addSpace(library, false);
|
||||
}
|
||||
|
||||
decompiler.decompileContext();
|
||||
}
|
||||
|
||||
@SuppressWarnings("UseOfSystemOutOrSystemErr")
|
||||
private static void addPath(List<File> list, String path) {
|
||||
File file = new File(path);
|
||||
if (file.exists()) {
|
||||
list.add(file);
|
||||
}
|
||||
else {
|
||||
System.out.println("warn: missing '" + path + "', ignored");
|
||||
}
|
||||
}
|
||||
|
||||
// *******************************************************************
|
||||
// Implementation
|
||||
// *******************************************************************
|
||||
|
Loading…
Reference in New Issue
Block a user