From 48ccb0fe563d8de2e7c206622baa7711244931c5 Mon Sep 17 00:00:00 2001 From: shadowislord Date: Fri, 6 Jun 2014 21:05:15 -0400 Subject: [PATCH] * Fix jinput native library loading - now the JNI library name is based on the name in the jar --- .../com/jme3/system/NativeLibraryLoader.java | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/jme3-desktop/src/main/java/com/jme3/system/NativeLibraryLoader.java b/jme3-desktop/src/main/java/com/jme3/system/NativeLibraryLoader.java index d12335594..4a6cfc752 100644 --- a/jme3-desktop/src/main/java/com/jme3/system/NativeLibraryLoader.java +++ b/jme3-desktop/src/main/java/com/jme3/system/NativeLibraryLoader.java @@ -355,19 +355,20 @@ public final class NativeLibraryLoader { // Determine what filename it should be extracted as. String loadedAsFileName; if (library.isJNI()) { - String nameWithArch; + // JNI libraries on Mac / JDK6 use jnilib extension. + // JNI libraries on Mac / JDK7 use dylib extension. + String fileNameInJarWithoutExtension + = fileNameInJar.substring(0, fileNameInJar.lastIndexOf(".")); - // Append "64" to path - // so that we don't overwrite the 32-bit version. - if (platform.is64Bit()) { - nameWithArch = name + "64"; + String systemJniExtension; + String dummyLib = System.mapLibraryName(""); + if (dummyLib.contains(".")) { + systemJniExtension = dummyLib.substring(dummyLib.lastIndexOf(".")); } else { - nameWithArch = name; + systemJniExtension = ""; } - // JNI libraries on Mac / JDK6 use jnilib extension. - // JNI libraries on Mac / JDK7 use dylib extension. - loadedAsFileName = System.mapLibraryName(nameWithArch); + loadedAsFileName = fileNameInJarWithoutExtension + systemJniExtension; } else { // Not a JNI library. // Just use the original filename as it is in the JAR.