OpenAL: Made the openal library path returned by the current ClassLoader and cwd more override java.library.path. Converted some printfDebug to printfDebugJava

This commit is contained in:
Elias Naur 2005-05-12 07:47:07 +00:00
parent 54e5020a34
commit 0f5281e24f
10 changed files with 54 additions and 54 deletions

View file

@ -76,11 +76,11 @@ public class LWJGLUtil {
*
* @param libNames List of library names to look for, in the form of Local Library name, Platform library name.
* At least 6 names must be passed. 2 for each supported platform in the following order: Windows, Linux, MacOSX.
* @param classloader The classloader to ask for librariy paths
* @param classloader The classloader to ask for library paths
* @return Paths to located libraries, if any
*/
public static String[] getLibraryPaths(String[] libNames, ClassLoader classloader) throws LWJGLException {
// need to pass path of possible locations of IL to native side
// need to pass path of possible locations of library to native side
List possible_paths = new ArrayList();
String libname;
@ -102,13 +102,6 @@ public class LWJGLUtil {
throw new LWJGLException("Unknown platform: " + getPlatform());
}
// Add all possible paths from java.library.path
StringTokenizer st = new StringTokenizer(System.getProperty("java.library.path"), File.pathSeparator);
while (st.hasMoreTokens()) {
String path = st.nextToken();
possible_paths.add(path + File.separator + platform_lib_name);
}
String classloader_path = LWJGLUtil.getPathFromClassLoader(libname, classloader);
if (classloader_path != null) {
LWJGLUtil.log("getPathFromClassLoader: Path found: " + classloader_path);
@ -125,6 +118,13 @@ public class LWJGLUtil {
//add cwd path
possible_paths.add(platform_lib_name);
// Add all possible paths from java.library.path
StringTokenizer st = new StringTokenizer(System.getProperty("java.library.path"), File.pathSeparator);
while (st.hasMoreTokens()) {
String path = st.nextToken();
possible_paths.add(path + File.separator + platform_lib_name);
}
//create needed string array
String[] paths = new String[possible_paths.size()];
possible_paths.toArray(paths);

View file

@ -137,6 +137,7 @@ public final class AL {
"lwjglaudio", "lwjglaudio.dll",
"openal", "libopenal.so",
"openal", "openal.dylib"}, AL.class.getClassLoader());
LWJGLUtil.log("Found " + oalPaths.length + " OpenAL paths");
nCreate(oalPaths);
created = true;