* Fix jinput native library loading - now the JNI library name is based on the name in the jar

experimental
shadowislord 11 years ago
parent 54ffe15dda
commit 48ccb0fe56
  1. 19
      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. // Determine what filename it should be extracted as.
String loadedAsFileName; String loadedAsFileName;
if (library.isJNI()) { 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 String systemJniExtension;
// so that we don't overwrite the 32-bit version. String dummyLib = System.mapLibraryName("");
if (platform.is64Bit()) { if (dummyLib.contains(".")) {
nameWithArch = name + "64"; systemJniExtension = dummyLib.substring(dummyLib.lastIndexOf("."));
} else { } else {
nameWithArch = name; systemJniExtension = "";
} }
// JNI libraries on Mac / JDK6 use jnilib extension. loadedAsFileName = fileNameInJarWithoutExtension + systemJniExtension;
// JNI libraries on Mac / JDK7 use dylib extension.
loadedAsFileName = System.mapLibraryName(nameWithArch);
} else { } else {
// Not a JNI library. // Not a JNI library.
// Just use the original filename as it is in the JAR. // Just use the original filename as it is in the JAR.

Loading…
Cancel
Save