diff --git a/pom.xml b/pom.xml
index face2d256..7ed7ba4ee 100644
--- a/pom.xml
+++ b/pom.xml
@@ -16,7 +16,7 @@
24.1.0
2.9.1
9.6
- 0.2.0
+ 0.2.1
1.0bcv
0.152
1.9.12
@@ -41,7 +41,7 @@
3.4.1.3
21.2.0
3.3
- 0.2.0
+ 0.2.1
0.6.0
3.3.4
2.1.1
@@ -242,8 +242,13 @@
org.exbin.auxiliary
- paged_data
- ${paged-data.version}
+ binary_data
+ ${binary-data.version}
+
+
+ org.exbin.auxiliary
+ binary_data-paged
+ ${binary-data.version}
org.bitbucket.mstrobel
diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/Constants.java b/src/main/java/the/bytecode/club/bytecodeviewer/Constants.java
index 2a18a5e3a..5a788810a 100644
--- a/src/main/java/the/bytecode/club/bytecodeviewer/Constants.java
+++ b/src/main/java/the/bytecode/club/bytecodeviewer/Constants.java
@@ -2,6 +2,7 @@
import java.io.File;
import java.io.PrintStream;
+
import org.objectweb.asm.Opcodes;
import the.bytecode.club.bytecodeviewer.resources.ResourceType;
@@ -68,8 +69,7 @@ public class Constants
public static final String fs = System.getProperty("file.separator");
public static final String nl = System.getProperty("line.separator");
- //TODO check if $HOME/.local/share exists, if so reference from there instead - #250
- public static final File BCVDir = new File(System.getProperty("user.home") + fs + ".Bytecode-Viewer");
+ public static final File BCVDir = resolveBCVRoot();
public static final File RT_JAR = new File(System.getProperty("java.home") + fs + "lib" + fs + "rt.jar");
public static final File JAVA_BINARY = new File(System.getProperty("java.home") + fs + "bin" + fs + "java.exe");
public static final File JAVA_BINARY_NIX = new File(System.getProperty("java.home") + fs + "bin" + fs + "java");
@@ -88,6 +88,30 @@ public class Constants
public static final PrintStream ERR = System.err;
public static final PrintStream OUT = System.out;
+ public static File resolveBCVRoot()
+ {
+ File defaultLocation = new File(System.getProperty("user.home") + fs + ".Bytecode-Viewer");
+
+ //if BCV was previously installed using the default directory, continue to use that
+ if(defaultLocation.exists())
+ return defaultLocation;
+
+ //handle XDG Base Directory - https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
+ if(isNix())
+ {
+ File homeLocal = new File(System.getProperty("user.home") + fs + ".local");
+ if(homeLocal.exists())
+ return new File(homeLocal, "share" + fs + ".Bytecode-Viewer");
+
+ File homeConfig = new File(System.getProperty("user.home") + fs + ".config");
+ if(homeConfig.exists())
+ return new File(homeConfig, ".Bytecode-Viewer");
+ }
+
+ //return BCV default location
+ return defaultLocation;
+ }
+
/**
* Returns the BCV directory
*
@@ -126,6 +150,17 @@ private static boolean isWindows()
return System.getProperty("os.name").toLowerCase().contains("win");
}
+ /**
+ * Checks if the OS contains 'nix', 'nux', or 'bsd'
+ *
+ * @return true if the os.name property contains 'nix', 'nux', or 'bsd'
+ */
+ private static boolean isNix()
+ {
+ String os = System.getProperty("os.name").toLowerCase();
+ return os.contains("nix") || os.contains("nux") || os.contains("bsd");
+ }
+
/**
* Detects developer mode or returns the current version
*/
diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/hexviewer/HexViewer.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/hexviewer/HexViewer.java
index c7c8ab26a..cfb1e31c9 100644
--- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/hexviewer/HexViewer.java
+++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/hexviewer/HexViewer.java
@@ -1,6 +1,6 @@
package the.bytecode.club.bytecodeviewer.gui.hexviewer;
-import org.exbin.auxiliary.paged_data.ByteArrayData;
+import org.exbin.auxiliary.binary_data.ByteArrayData;
import org.exbin.bined.CodeAreaCaretPosition;
import org.exbin.bined.CodeType;
import org.exbin.bined.EditMode;
@@ -37,6 +37,7 @@ public class HexViewer extends JPanel {
public HexViewer(byte[] contentData) {
super(new BorderLayout());
codeArea = new CodeArea();
+ codeArea.setFocusTraversalKeysEnabled(false);
codeArea.setPainter(new HighlightNonAsciiCodeAreaPainter(codeArea));
toolBar = new JToolBar();
statusPanel = new BinaryStatusPanel() {
diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/hexviewer/ValuesPanel.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/hexviewer/ValuesPanel.java
index 0532d39e2..eb2f0d6f4 100644
--- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/hexviewer/ValuesPanel.java
+++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/hexviewer/ValuesPanel.java
@@ -14,8 +14,7 @@
import org.exbin.bined.CodeAreaCaretPosition;
import org.exbin.bined.DataChangedListener;
import org.exbin.bined.swing.basic.CodeArea;
-import org.exbin.auxiliary.paged_data.BinaryData;
-import org.exbin.bined.capability.EditModeCapable;
+import org.exbin.auxiliary.binary_data.BinaryData;
/**
* Values side panel.
@@ -711,7 +710,7 @@ private boolean isSigned() {
}
private boolean isEditable() {
- return ((EditModeCapable) codeArea).isEditable();
+ return codeArea.isEditable();
}
private ByteOrder getByteOrder() {