Fix File Chooser Selected Folder

This commit is contained in:
Konloch 2021-07-29 21:00:40 -07:00
parent 01928393c5
commit c94e7e7403
3 changed files with 13 additions and 3 deletions

View file

@ -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

View file

@ -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()

View file

@ -44,7 +44,10 @@ public class FileChooser extends JFileChooser
HashSet<String> extensionSet = new HashSet<>(Arrays.asList(extensions));
try {
setSelectedFile(file);
if(file.isDirectory())
setCurrentDirectory(file);
else
setSelectedFile(file);
} catch (Exception ignored) { }
setDialogTitle(title);