From 0928e61778979a56e7b858290fb936db3e36dbd3 Mon Sep 17 00:00:00 2001 From: Maciej Gajek Date: Thu, 21 Dec 2023 11:22:02 +0100 Subject: [PATCH] Update resource path for M1 MacOS --- .../src/main/java/libsodiumjni/internal/LoadLibrary.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libsodiumjni/src/main/java/libsodiumjni/internal/LoadLibrary.java b/libsodiumjni/src/main/java/libsodiumjni/internal/LoadLibrary.java index 45b3dec..fa6be47 100644 --- a/libsodiumjni/src/main/java/libsodiumjni/internal/LoadLibrary.java +++ b/libsodiumjni/src/main/java/libsodiumjni/internal/LoadLibrary.java @@ -20,8 +20,11 @@ public static void initialize(String libraryPath) { } public static String resourcePath() { + Boolean isArmArch = System.getProperty("os.arch").toLowerCase(Locale.ROOT).contains("aarch64"); + String osName = System.getProperty("os.name").toLowerCase(Locale.ROOT); if (osName.contains("linux")) return "META-INF/native/linux64/libsodiumjni.so"; + else if (osName.contains("mac") && isArmArch) return "META-INF/native/arm-darwin/libsodiumjni.dylib"; else if (osName.contains("mac")) return "META-INF/native/darwin/libsodiumjni.dylib"; else if (osName.contains("windows")) return "META-INF/native/windows64/libsodiumjni.dll"; else