diff --git a/src/main/java/me/n1ar4/jar/obfuscator/utils/JNIUtil.java b/src/main/java/me/n1ar4/jar/obfuscator/utils/JNIUtil.java index 748c95d..9b85e81 100644 --- a/src/main/java/me/n1ar4/jar/obfuscator/utils/JNIUtil.java +++ b/src/main/java/me/n1ar4/jar/obfuscator/utils/JNIUtil.java @@ -1,6 +1,5 @@ package me.n1ar4.jar.obfuscator.utils; -import me.n1ar4.jar.obfuscator.Const; import me.n1ar4.jar.obfuscator.jvmti.Constants; import java.io.ByteArrayOutputStream; @@ -42,11 +41,9 @@ private static boolean deleteUrls() { public static boolean loadLib(String path) { Path p = Paths.get(path); if (!Files.exists(p)) { - return false; } if (Files.isDirectory(p)) { - return false; } String os = System.getProperty("os.name").toLowerCase(); @@ -63,14 +60,15 @@ public static boolean loadLib(String path) { return false; } System.load(p.toFile().getAbsolutePath()); + return true; } else { String so = p.toFile().getAbsolutePath(); - if (!so.endsWith(".so")) { - return false; + if (so.endsWith(".so") || so.endsWith(".dylib")) { + System.load(so); + return true; } - System.load(so); + return false; } - return true; } /**