From 6f3166a193d8202f259dd9977ddb093d0b9ee933 Mon Sep 17 00:00:00 2001 From: Sleeyax Date: Sat, 24 Sep 2022 00:36:25 +0200 Subject: [PATCH] Fix MacOS native library not found (closes #16) --- build.sh | 5 +++-- src/main/java/burp/ServerLibrary.java | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/build.sh b/build.sh index 33c540c..2a25e32 100755 --- a/build.sh +++ b/build.sh @@ -19,11 +19,12 @@ copy() { # params local binary=$1 local resourceFolder=$2 + local prefix=$3 local extension="${binary##*.}" # locations to copy to and from local binaryPath="./src-go/server/build/$binary" - local resourcePath="./src/main/resources/$resourceFolder/server.$extension" + local resourcePath="./src/main/resources/$resourceFolder/${prefix}server.$extension" # perform copy mkdir -p $(dirname "$resourcePath") @@ -32,7 +33,7 @@ copy() { } copy_macos() { - copy "server-darwin-amd64.dylib" "darwin-x86-64" + copy "server-darwin-amd64.dylib" "darwin-x86-64" "lib" } copy_linux_386() { diff --git a/src/main/java/burp/ServerLibrary.java b/src/main/java/burp/ServerLibrary.java index 20e6925..d07d85d 100644 --- a/src/main/java/burp/ServerLibrary.java +++ b/src/main/java/burp/ServerLibrary.java @@ -5,7 +5,7 @@ import com.sun.jna.Platform; public interface ServerLibrary extends Library { - ServerLibrary INSTANCE = Native.load("server." + (Platform.isWindows() ? "dll" : Platform.isMac() ? "dylib" : "so"), ServerLibrary.class); + ServerLibrary INSTANCE = Native.load((Platform.isMac() ? "lib" : "") + "server." + (Platform.isWindows() ? "dll" : Platform.isMac() ? "dylib" : "so"), ServerLibrary.class); String StartServer(String address); String StopServer();