summaryrefslogtreecommitdiff
path: root/src/main/java/cuchaz
diff options
context:
space:
mode:
authorGravatar gegy10002018-07-03 14:41:14 +0200
committerGravatar gegy10002018-07-03 14:41:14 +0200
commitf967021ea4a78de9aea0873eeb3e1359a4664a2b (patch)
tree96e480361f67415150b3d8dd3ca8f27834691ff7 /src/main/java/cuchaz
parentIgnore invalid decompiled variable indices (diff)
downloadenigma-f967021ea4a78de9aea0873eeb3e1359a4664a2b.tar.gz
enigma-f967021ea4a78de9aea0873eeb3e1359a4664a2b.tar.xz
enigma-f967021ea4a78de9aea0873eeb3e1359a4664a2b.zip
Output directly to file on source export
Diffstat (limited to 'src/main/java/cuchaz')
-rw-r--r--src/main/java/cuchaz/enigma/Deobfuscator.java8
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
12package cuchaz.enigma; 12package cuchaz.enigma;
13 13
14import com.google.common.base.Charsets;
15import com.google.common.collect.Lists; 14import com.google.common.collect.Lists;
16import com.google.common.collect.Maps; 15import com.google.common.collect.Maps;
17import com.google.common.collect.Sets; 16import 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