diff options
| author | 2018-07-03 14:41:14 +0200 | |
|---|---|---|
| committer | 2018-07-03 14:41:14 +0200 | |
| commit | f967021ea4a78de9aea0873eeb3e1359a4664a2b (patch) | |
| tree | 96e480361f67415150b3d8dd3ca8f27834691ff7 | |
| parent | Ignore invalid decompiled variable indices (diff) | |
| download | enigma-f967021ea4a78de9aea0873eeb3e1359a4664a2b.tar.gz enigma-f967021ea4a78de9aea0873eeb3e1359a4664a2b.tar.xz enigma-f967021ea4a78de9aea0873eeb3e1359a4664a2b.zip | |
Output directly to file on source export
| -rw-r--r-- | src/main/java/cuchaz/enigma/Deobfuscator.java | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/main/java/cuchaz/enigma/Deobfuscator.java b/src/main/java/cuchaz/enigma/Deobfuscator.java index ccd099c6..6fe6e643 100644 --- a/src/main/java/cuchaz/enigma/Deobfuscator.java +++ b/src/main/java/cuchaz/enigma/Deobfuscator.java | |||
| @@ -11,7 +11,6 @@ | |||
| 11 | 11 | ||
| 12 | package cuchaz.enigma; | 12 | package cuchaz.enigma; |
| 13 | 13 | ||
| 14 | import com.google.common.base.Charsets; | ||
| 15 | import com.google.common.collect.Lists; | 14 | import com.google.common.collect.Lists; |
| 16 | import com.google.common.collect.Maps; | 15 | import com.google.common.collect.Maps; |
| 17 | import com.google.common.collect.Sets; | 16 | import com.google.common.collect.Sets; |
| @@ -277,13 +276,14 @@ public class Deobfuscator { | |||
| 277 | 276 | ||
| 278 | try { | 277 | try { |
| 279 | // get the source | 278 | // get the source |
| 280 | String source = getSource(getSourceTree(obfClassEntry.getName())); | 279 | CompilationUnit sourceTree = getSourceTree(obfClassEntry.getName()); |
| 281 | 280 | ||
| 282 | // write the file | 281 | // write the file |
| 283 | File file = new File(dirOut, deobfClassEntry.getName().replace('.', '/') + ".java"); | 282 | File file = new File(dirOut, deobfClassEntry.getName().replace('.', '/') + ".java"); |
| 284 | file.getParentFile().mkdirs(); | 283 | file.getParentFile().mkdirs(); |
| 285 | try (OutputStreamWriter out = new OutputStreamWriter(new BufferedOutputStream(new FileOutputStream(file)), Charsets.UTF_8)) { | 284 | try (Writer writer = new BufferedWriter(new FileWriter(file))) { |
| 286 | out.write(source); | 285 | sourceTree.acceptVisitor(new InsertParenthesesVisitor(), null); |
| 286 | sourceTree.acceptVisitor(new JavaOutputVisitor(new PlainTextOutput(writer), this.settings), null); | ||
| 287 | } | 287 | } |
| 288 | } catch (Throwable t) { | 288 | } catch (Throwable t) { |
| 289 | // don't crash the whole world here, just log the error and keep going | 289 | // don't crash the whole world here, just log the error and keep going |