diff options
author | Sven Gothel <[email protected]> | 2013-02-09 06:17:45 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2013-02-09 06:17:45 +0100 |
commit | 30841742e735e70b3946d16711089960084e894c (patch) | |
tree | a5ddb9911e6f6bc2e1169f9f7041c6819154e028 /src/java/com | |
parent | a47d19d59cc8772dcf1ef67083c4401d913ad8d2 (diff) |
Bug 681: Add Elf Parsing for other OS than Linux, if ARM and !ANDROID using /proc/self/exe (Linux) or a found java/jvm native lib.
- PlatformPropsImpl.queryABITypeImpl: Check Elf Header for ARM + !ANDROID (i.e. add other OS than Linux, use native java/jmv lib)
- NativeLibrary.enumerateLibraryPaths: Add 'sun.boot.library.path' to enumeration!
- TestElfReader01: Add test for finding java/jvm native lib and parse it
Diffstat (limited to 'src/java/com')
-rwxr-xr-x | src/java/com/jogamp/common/os/NativeLibrary.java | 54 |
1 files changed, 40 insertions, 14 deletions
diff --git a/src/java/com/jogamp/common/os/NativeLibrary.java b/src/java/com/jogamp/common/os/NativeLibrary.java index 49ec860..130812c 100755 --- a/src/java/com/jogamp/common/os/NativeLibrary.java +++ b/src/java/com/jogamp/common/os/NativeLibrary.java @@ -277,11 +277,11 @@ public class NativeLibrary implements DynamicLookupHelper { /** Given the base library names (no prefixes/suffixes) for the various platforms, enumerate the possible locations and names of the indicated native library on the system. */ - public static List<String> enumerateLibraryPaths(String windowsLibName, - String unixLibName, - String macOSXLibName, - boolean searchSystemPathFirst, - ClassLoader loader) { + public static List<String> enumerateLibraryPaths(final String windowsLibName, + final String unixLibName, + final String macOSXLibName, + final boolean searchSystemPathFirst, + final ClassLoader loader) { List<String> paths = new ArrayList<String>(); String libName = selectName(windowsLibName, unixLibName, macOSXLibName); if (libName == null) { @@ -312,17 +312,43 @@ public class NativeLibrary implements DynamicLookupHelper { } // Add entries from java.library.path - String javaLibraryPath = - AccessController.doPrivileged(new PrivilegedAction<String>() { - public String run() { - return System.getProperty("java.library.path"); + final String[] javaLibraryPaths = + AccessController.doPrivileged(new PrivilegedAction<String[]>() { + public String[] run() { + int count = 0; + final String usrPath = System.getProperty("java.library.path"); + if(null != usrPath) { + count++; + } + final String sysPath = System.getProperty("sun.boot.library.path"); + if(null != sysPath) { + count++; + } + final String[] res = new String[count]; + int i=0; + if (searchSystemPathFirst) { + if(null != sysPath) { + res[i++] = sysPath; + } + } + if(null != usrPath) { + res[i++] = usrPath; + } + if (!searchSystemPathFirst) { + if(null != sysPath) { + res[i++] = sysPath; + } + } + return res; } }); - if (javaLibraryPath != null) { - StringTokenizer tokenizer = new StringTokenizer(javaLibraryPath, File.pathSeparator); - while (tokenizer.hasMoreTokens()) { - addPaths(tokenizer.nextToken(), baseNames, paths); - } + if ( null != javaLibraryPaths ) { + for( int i=0; i < javaLibraryPaths.length; i++ ) { + final StringTokenizer tokenizer = new StringTokenizer(javaLibraryPaths[i], File.pathSeparator); + while (tokenizer.hasMoreTokens()) { + addPaths(tokenizer.nextToken(), baseNames, paths); + } + } } // Add current working directory |