Replace .jnilib with .dylib on OS X with JDK 6. Resolve #100

This commit is contained in:
Ioannis Tsakpinis 2014-11-28 13:26:26 +02:00
parent 45678633f9
commit 8cdaf59905
3 changed files with 20 additions and 4 deletions

View File

@ -319,6 +319,21 @@ public class LWJGLUtil {
}
}
/**
* Wraps {@link System#mapLibraryName}. On OS X with JDK 6, the .jnilib file
* extension will be replaced with .dylib.
*
* @param name the name of the library.
*
* @return a platform-dependent native library name.
*/
public static String mapLibraryName(String name) {
String libName = System.mapLibraryName(name);
return LWJGLUtil.getPlatform() == LWJGLUtil.PLATFORM_MACOSX && libName.endsWith(".jnilib")
? libName.substring(0, libName.length() - ".jnilib".length()) + ".dylib"
: libName;
}
/**
* Locates the paths required by a library.
*
@ -421,7 +436,7 @@ public class LWJGLUtil {
*/
private static String getPathFromClassLoader(final String libname, final ClassLoader classloader) {
Class<?> c = null;
try {
log("getPathFromClassLoader: searching for: " + libname);
c = classloader.getClass();

View File

@ -67,8 +67,7 @@ public final class Sys {
public Object run() {
String library_path = System.getProperty("org.lwjgl.librarypath");
if (library_path != null) {
System.load(library_path + File.separator +
System.mapLibraryName(lib_name));
System.load(library_path + File.separator + LWJGLUtil.mapLibraryName(lib_name));
} else {
System.loadLibrary(lib_name);
}

View File

@ -31,6 +31,8 @@
*/
package org.lwjgl.util.applet;
import org.lwjgl.LWJGLUtil;
import java.applet.Applet;
import java.applet.AppletStub;
import java.awt.BorderLayout;
@ -1219,7 +1221,7 @@ public class AppletLoader extends Applet implements Runnable, AppletStub {
// allow non lwjgl native to be found from cache directory
protected String findLibrary (String libname) {
String libPath = path + "natives" + File.separator + System.mapLibraryName(libname);
String libPath = path + "natives" + File.separator + LWJGLUtil.mapLibraryName(libname);
if (new File(libPath).exists()) {
return libPath;