Removed multiple library names support from Sys.java, it is not needed anymore

This commit is contained in:
Elias Naur 2006-07-03 10:28:32 +00:00
parent 85ca7c65bb
commit 1efa8258d1
6 changed files with 6 additions and 63 deletions

View file

@ -39,13 +39,6 @@ package org.lwjgl;
* $Id$
*/
abstract class DefaultSysImplementation implements SysImplementation {
/** The native library name */
protected static final String LIBRARY_NAME = "lwjgl";
public String[] getNativeLibraryNames() {
return new String[]{LIBRARY_NAME};
}
public native String getNativeLibraryVersion();
public native void setDebug(boolean debug);

View file

@ -42,37 +42,6 @@ import java.security.PrivilegedExceptionAction;
* $Id$
*/
class MacOSXSysImplementation extends J2SESysImplementation {
public String[] getNativeLibraryNames() {
/* If we're on 10.4, fine, we'll just try the default library name. For
* earlier versions of Mac OS X, try the legacy library first.
*
* Having a kludge like this is unfortunate, but necessary for the following reasons:
* 1. We need two libraries to support Mac OS X 10.2, 10.3 and 10.4. We could
* cover 10.2, 10.3 and 10.4 with one gcc 3 compiled library, but then we
* loose intel mac support. Instead, we'll distribute two versions of the lwjgl
* native library, the default and a legacy one.
* 2. The default library will be universal ('fat') with both intel and powerpc support
* compiled in. This requires gcc 4, and makes the library unusable on Mac OS X 10.3
* and earlier (actually 10.3.9 has the required gcc 4 libraries, but we'll ignore that).
* We could still choose to load the default library first, and the legacy one later,
* but a bug in the Mac OS X java implementation forces a java program to exit
* if the loaded library has a missing dependency (The correct behaviour is to throw
* an UnsatisfiedLinkError, like on linux and windows).
* 3. If the LWJGL program is launched with an intelligent ClassLoader, this issue can be avoided
* altogether, and the legacy library naming can be avoided too. For example, when
* using webstart, one can supply two nativelib references, one for Mac OS X 10.4
* (the default library), and one for earlier Mac OS X (the legacy library). This is the
* preferred way to deploy the libraries. The legacy naming is for the users that don't want to
* mess around with libraries and classloaders. They can simply make sure that lwjgl.jar
* is in the classpath and that both the default library and the legacy library is in the native
* library path (java.library.path).
*/
if (LWJGLUtil.isMacOSXEqualsOrBetterThan(10, 4))
return super.getNativeLibraryNames();
else
return new String[]{LIBRARY_NAME + "-legacy", LIBRARY_NAME};
}
public boolean openURL(String url) {
try {
Method openURL_method = (Method)AccessController.doPrivileged(new PrivilegedExceptionAction() {

View file

@ -50,8 +50,10 @@ import org.lwjgl.input.Mouse;
* $Id$
*/
public final class Sys {
/** The native library name */
private static final String JNI_LIBRARY_NAME = "lwjgl";
/** Current version of library */
/** Current version of library */
private static final String VERSION = "1.0beta2";
/** The implementation instance to delegate platform specific behavior to */
@ -74,22 +76,7 @@ public final class Sys {
static {
implementation = createImplementation();
String[] library_names = implementation.getNativeLibraryNames();
UnsatisfiedLinkError last_load_error = null;
for (int i = 0; i < library_names.length; i++) {
try {
loadLibrary(library_names[i]);
last_load_error = null;
break;
} catch (UnsatisfiedLinkError e) {
last_load_error = e;
}
}
// check for error
if (last_load_error != null) {
throw last_load_error;
}
loadLibrary(JNI_LIBRARY_NAME);
String native_version = implementation.getNativeLibraryVersion();
if (!native_version.equals(getVersion()))

View file

@ -41,12 +41,6 @@ package org.lwjgl;
* $Id$
*/
interface SysImplementation {
/**
* Return an array of possible library names. later names
* tried last.
*/
public String[] getNativeLibraryNames();
/**
* Return the version of the native library
*/

View file

@ -225,7 +225,7 @@ public class LWJGLInstaller {
*/
static String createTemporaryDir(final String user_temp_dir) throws Exception {
return (String) AccessController.doPrivileged(new PrivilegedExceptionAction() {
public Object run() {
public Object run() throws Exception {
// create the temp directory
File tempDir = new File(user_temp_dir + File.separator + "lwjgl-" + System.currentTimeMillis());
if(!tempDir.mkdir()) {

View file

@ -65,7 +65,7 @@ public class AppletTest extends Applet {
try {
LWJGLInstaller.tempInstall();
} catch (LWJGLException le) {
} catch (Exception le) {
/* screwed */
le.printStackTrace();
}