From 5f32dff724591bcb4cbf1f283c224c235ad84407 Mon Sep 17 00:00:00 2001 From: Konloch Date: Sun, 29 Sep 2024 08:15:25 -0600 Subject: [PATCH] Run Temporary Plugins --- .../bytecode/club/bytecodeviewer/plugin/PluginWriter.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/PluginWriter.java b/src/main/java/the/bytecode/club/bytecodeviewer/plugin/PluginWriter.java index f5a94c1d..63e6ee82 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/PluginWriter.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/plugin/PluginWriter.java @@ -39,6 +39,7 @@ import javax.swing.*; import java.awt.*; import java.io.File; import java.io.IOException; +import java.nio.charset.StandardCharsets; import static the.bytecode.club.bytecodeviewer.Constants.FS; import static the.bytecode.club.bytecodeviewer.Constants.TEMP_DIRECTORY; @@ -170,7 +171,11 @@ public class PluginWriter extends JFrame try { //write to temporary file location - Files.copy(savePath, tempFile); + if(savePath != null) + Files.copy(savePath, tempFile); + else + Files.write(area.getText().getBytes(StandardCharsets.UTF_8), tempFile); + //run plugin from that location PluginManager.runPlugin(tempFile); }