Skip to content

Commit 5bac732

Browse files
committed
Temp File API Update
Refactoring & implemented automatic decompiler cleanup flag
1 parent ed59212 commit 5bac732

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

src/main/java/the/bytecode/club/bytecodeviewer/decompilers/impl/FernFlowerDecompiler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ public String decompileClassNode(ClassNode cn, byte[] bytes)
111111
{
112112
//cleanup temp files
113113
if(tempFile != null)
114-
tempFile.delete();
114+
tempFile.cleanup();
115115
}
116116

117117
return FERNFLOWER + " " + ERROR + "! " + ExceptionUI.SEND_STACKTRACE_TO + NL + NL

src/main/java/the/bytecode/club/bytecodeviewer/util/TempFile.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package the.bytecode.club.bytecodeviewer.util;
22

3+
import the.bytecode.club.bytecodeviewer.Constants;
4+
35
import java.io.File;
46
import java.util.HashSet;
57

@@ -59,8 +61,11 @@ public void markAsCreatedFile(File file)
5961
createdFilePaths.add(file.getAbsolutePath());
6062
}
6163

62-
public void delete()
64+
public void cleanup()
6365
{
66+
if(!Constants.DECOMPILERS_AUTOMATICALLY_CLEANUP)
67+
return;
68+
6469
//delete all the items
6570
for(String path : createdFilePaths)
6671
{

0 commit comments

Comments
 (0)