|
From: Brian M. <ma...@us...> - 2005-05-19 22:31:47
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/fmod3 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5285 Modified Files: FMOD.java Log Message: fixed fmod webstart loading Index: FMOD.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/fmod3/FMOD.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- FMOD.java 18 May 2005 21:02:01 -0000 1.12 +++ FMOD.java 19 May 2005 22:31:20 -0000 1.13 @@ -31,13 +31,12 @@ */ package org.lwjgl.fmod3; -import java.io.File; import java.lang.reflect.Method; import java.nio.FloatBuffer; import java.util.ArrayList; import java.util.HashMap; -import java.util.StringTokenizer; +import org.lwjgl.LWJGLException; import org.lwjgl.LWJGLUtil; /** @@ -251,57 +250,18 @@ return; } - // create, passing potential locations for native fmod library - nCreate(constructFMODSearchPaths()); - created = true; - } - - /** - * Retrieves an array of strings, with potential locations for - * the native fmod library - * @return array of strings, with potential locations for the native fmod library - */ - private static String[] constructFMODSearchPaths() { - // miscellaneous values - String libpath = System.getProperty("java.library.path"); - String seperator = System.getProperty("path.separator"); - - // determine os library name - String dllName = FMOD_WIN32_LIBRARY_NAME; - switch (LWJGLUtil.getPlatform()) { - case LWJGLUtil.PLATFORM_MACOSX: - dllName = FMOD_OSX_LIBRARY_NAME; - break; - case LWJGLUtil.PLATFORM_LINUX: - dllName = FMOD_LINUX_LIBRARY_NAME; - break; - default: - throw new LinkageError("Unsupported platform"); - } - - String jwsPath = getPathFromJWS(dllName); - LWJGLUtil.log("getPathFromJWS: Paths found: " + jwsPath); - if (jwsPath != null) { - libpath += seperator - + jwsPath.substring(0, jwsPath.lastIndexOf(File.separator)); - } - - // split, and rebuild library path to path + dll - StringTokenizer st = new StringTokenizer(libpath, seperator); - String[] paths = new String[st.countTokens() + 1]; - - //build paths - for (int i = 0; i < paths.length - 1; i++) { - paths[i] = st.nextToken() + File.separator; - } - - for(int i=0 ; i<paths.length; i++) { - LWJGLUtil.log("Will search " + paths[i] + " for " + dllName); + try { + String[] fmodPaths = LWJGLUtil.getLibraryPaths(new String[]{ + "fmod", "fmod.dll", + "fmod", "libfmod.so", + "fmod", "static-ignored"}, + FMOD.class.getClassLoader()); + LWJGLUtil.log("Found " + fmodPaths.length + " FMOD paths"); + nCreate(fmodPaths); + created = true; + } catch (LWJGLException le) { + throw new FMODException(le.getMessage()); } - - //add cwd path - paths[paths.length - 1] = dllName; - return paths; } /** |