From c94e7e7403f3f2f642f794cd82bec618a9cb5f2b Mon Sep 17 00:00:00 2001 From: Konloch Date: Thu, 29 Jul 2021 21:00:40 -0700 Subject: [PATCH] Fix File Chooser Selected Folder --- .../bytecode/club/bytecodeviewer/BytecodeViewer.java | 1 - .../bytecode/club/bytecodeviewer/Configuration.java | 10 +++++++++- .../bytecodeviewer/gui/components/FileChooser.java | 5 ++++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/BytecodeViewer.java b/src/main/java/the/bytecode/club/bytecodeviewer/BytecodeViewer.java index cba69d59..a2862118 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/BytecodeViewer.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/BytecodeViewer.java @@ -100,7 +100,6 @@ import static the.bytecode.club.bytecodeviewer.Constants.*; * + Add stackmapframes to bytecode decompiler * + Add https://github.com/exbin/bined as the replacement Hed Viewer/Editor * + Make the decompilers launch in a separate process - * + Make it use that global last used file folder inside of export as jar * + Make zipfile not include the decode shit * + Add decompile as zip for krakatau-bytecode, jd-gui and smali for CLI * + Add decompile all as zip for CLI diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/Configuration.java b/src/main/java/the/bytecode/club/bytecodeviewer/Configuration.java index c982f2ac..1d15dcd9 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/Configuration.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/Configuration.java @@ -6,6 +6,7 @@ import the.bytecode.club.bytecodeviewer.gui.theme.RSTATheme; import the.bytecode.club.bytecodeviewer.translation.Language; import java.io.File; +import java.io.IOException; /*************************************************************************** * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * @@ -118,7 +119,14 @@ public class Configuration if(lastDir.getParentFile() != null && lastDir.getParentFile().exists()) return lastDir; - return new File("."); + try + { + return new File(".").getCanonicalFile(); + } + catch (IOException e) + { + return new File("."); + } } public static File getLastPluginDirectory() diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/FileChooser.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/FileChooser.java index c8be2795..e5459669 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/FileChooser.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/FileChooser.java @@ -44,7 +44,10 @@ public class FileChooser extends JFileChooser HashSet extensionSet = new HashSet<>(Arrays.asList(extensions)); try { - setSelectedFile(file); + if(file.isDirectory()) + setCurrentDirectory(file); + else + setSelectedFile(file); } catch (Exception ignored) { } setDialogTitle(title);