Mac OS X: Use GetStringUTFChars instead of GetNativeChars to get the openal path
This commit is contained in:
parent
96463f2ef6
commit
0e0ef2f1ab
|
@ -113,26 +113,32 @@ static bool LoadOpenAL(JNIEnv *env, jobjectArray oalPaths) {
|
||||||
jsize pathcount = (*env)->GetArrayLength(env, oalPaths);
|
jsize pathcount = (*env)->GetArrayLength(env, oalPaths);
|
||||||
int i;
|
int i;
|
||||||
jstring path;
|
jstring path;
|
||||||
char *path_str;
|
const char *path_str;
|
||||||
|
|
||||||
printfDebug("Found %d OpenAL paths\n", (int)pathcount);
|
printfDebug("Found %d OpenAL paths\n", (int)pathcount);
|
||||||
for(i=0;i<pathcount;i++) {
|
for(i=0;i<pathcount;i++) {
|
||||||
path = (jstring) (*env)->GetObjectArrayElement(env, oalPaths, i);
|
path = (jstring) (*env)->GetObjectArrayElement(env, oalPaths, i);
|
||||||
|
#ifdef _WIN32
|
||||||
path_str = GetStringNativeChars(env, path);
|
path_str = GetStringNativeChars(env, path);
|
||||||
printfDebug("Testing '%s'\n", path_str);
|
printfDebug("Testing '%s'\n", path_str);
|
||||||
#ifdef _WIN32
|
|
||||||
handleOAL = LoadLibrary(path_str);
|
handleOAL = LoadLibrary(path_str);
|
||||||
|
free(path_str);
|
||||||
#endif
|
#endif
|
||||||
#ifdef _X11
|
#ifdef _X11
|
||||||
|
path_str = GetStringNativeChars(env, path);
|
||||||
|
printfDebug("Testing '%s'\n", path_str);
|
||||||
handleOAL = dlopen(path_str, RTLD_LAZY);
|
handleOAL = dlopen(path_str, RTLD_LAZY);
|
||||||
|
free(path_str);
|
||||||
#endif
|
#endif
|
||||||
#ifdef _MACOSX
|
#ifdef _MACOSX
|
||||||
|
path_str = (*env)->GetStringUTFChars(env, path, NULL);
|
||||||
|
printfDebug("Testing '%s'\n", path_str);
|
||||||
handleOAL = NSAddImage(path_str, NSADDIMAGE_OPTION_RETURN_ON_ERROR);
|
handleOAL = NSAddImage(path_str, NSADDIMAGE_OPTION_RETURN_ON_ERROR);
|
||||||
|
(*env)->ReleaseStringUTFChars(env, path, path_str);
|
||||||
#endif
|
#endif
|
||||||
if (handleOAL != NULL) {
|
if (handleOAL != NULL) {
|
||||||
printfDebug("Found OpenAL at '%s'\n", path_str);
|
printfDebug("Found OpenAL at '%s'\n", path_str);
|
||||||
}
|
}
|
||||||
free(path_str);
|
|
||||||
if (handleOAL != NULL) {
|
if (handleOAL != NULL) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue