From 828dc89c33b8de399090e4d2c9a892611a3bd569 Mon Sep 17 00:00:00 2001 From: Kenneth Russel Date: Sun, 21 Jan 2007 01:27:27 +0000 Subject: Fixed Issue 262: DRIHack problems with ATI and possibly other drivers Added support to GlueGen's NativeLibrary class for relative library path names which do not require expansion; for example, "libGL.so.1". Changed the DRIHack to first attempt to open libGL.so.1 instead of "GL", which expanded to "libGL.so". For some reason, this causes ATI's drivers to be picked up properly. Tested with various JOGL demos. git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/../svn-server-sync/gluegen/trunk@56 a78bb65f-1512-4460-ba86-f6dc96a7bf27 --- .../com/sun/gluegen/runtime/NativeLibrary.java | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'src') diff --git a/src/java/com/sun/gluegen/runtime/NativeLibrary.java b/src/java/com/sun/gluegen/runtime/NativeLibrary.java index 9b28da4..1341012 100755 --- a/src/java/com/sun/gluegen/runtime/NativeLibrary.java +++ b/src/java/com/sun/gluegen/runtime/NativeLibrary.java @@ -306,6 +306,33 @@ public class NativeLibrary { } private static String[] buildNames(String libName) { + // If the library name already has the prefix / suffix added + // (principally because we want to force a version number on Unix + // operating systems) then just return the library name. + if (libName.startsWith(prefixes[0])) { + if (libName.endsWith(suffixes[0])) { + return new String[] { libName }; + } + + int idx = libName.indexOf(suffixes[0]); + boolean ok = true; + if (idx >= 0) { + // Check to see if everything after it is a Unix version number + for (int i = idx + suffixes[0].length(); + i < libName.length(); + i++) { + char c = libName.charAt(i); + if (!(c == '.' || (c >= '0' && c <= '9'))) { + ok = false; + break; + } + } + if (ok) { + return new String[] { libName }; + } + } + } + String[] res = new String[prefixes.length * suffixes.length]; int idx = 0; for (int i = 0; i < prefixes.length; i++) { -- cgit v1.2.3