- change natives extraction to support audio FX on osx (for extracting openal.dylib for soft fx)

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9686 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
nor..67 12 years ago
parent 639449db4d
commit a98fbb83b6
  1. 31
      engine/src/desktop/com/jme3/system/Natives.java

@ -118,13 +118,27 @@ public final class Natives {
}
public static void extractNativeLib(String sysName, String name, boolean load, boolean warning) throws IOException {
String fullname = System.mapLibraryName(name);
String path = "native/" + sysName + "/" + fullname;
//XXX: Hack to extract jnilib to dylib on OSX Java 1.7+
if(sysName.equals("macosx")){
path = path.replaceAll("dylib","jnilib");
String fullname;
String path;
//XXX: hack to allow specifying the extension via supplying an extension in the name (e.g. "blah.dylib")
// this is needed on osx where the openal.dylib always needs to be extracted as dylib
// and never as jnilib, even if that is the platform JNI lib suffix (OpenAL is no JNI library)
if(!name.contains(".")){
// automatic name mapping
fullname = System.mapLibraryName(name);
path = "native/" + sysName + "/" + fullname;
//XXX: Hack to extract jnilib to dylib on OSX Java 1.7+
// This assumes all jni libs for osx are stored as "jnilib" in the jar file.
// It will be extracted with the name required for the platform.
// At a later stage this should probably inverted so that dylib is the default name.
if(sysName.equals("macosx")){
path = path.replaceAll("dylib","jnilib");
}
} else{
fullname = name;
path = "native/" + sysName + "/" + fullname;
}
URL url = Thread.currentThread().getContextClassLoader().getResource(path);
if (url == null) {
@ -296,8 +310,9 @@ public final class Natives {
if (needLWJGL) {
extractNativeLib("macosx", "lwjgl");
}
// if (needOAL)
// extractNativeLib("macosx", "openal");
if (needOAL){
extractNativeLib("macosx", "openal.dylib");
}
if (needJInput) {
extractNativeLib("macosx", "jinput-osx");
}

Loading…
Cancel
Save