added DefaultControllerEnvironment.loadLibrary convenience method for plugins. It will also respect the new net.java.games.input.librarypath property for locating natives (useful for applets). Removed the mac os x jinput-osx-legacy library loading, as it is not necessary anymore with the combined 10.3/10.4 library

This commit is contained in:
elias 2006-07-03 11:59:10 +00:00
parent d5ea04d3af
commit 4306f119c2
5 changed files with 25 additions and 36 deletions

View file

@ -92,6 +92,27 @@ class DefaultControllerEnvironment extends ControllerEnvironment {
private PluginClassLoader pluginLoader = new PluginClassLoader();
private Collection loadedPlugins = new ArrayList();
/**
* Static utility method for loading native libraries.
* It will try to load from either the path given by
* the net.java.games.input.librarypath property
* or through System.loadLibrary().
*
*/
static void loadLibrary(final String lib_name) {
AccessController.doPrivileged(
new PrivilegedAction() {
public final Object run() {
String lib_path = System.getProperty("net.java.games.input.librarypath");
if (lib_path != null)
System.load(lib_path + File.separator + System.mapLibraryName(lib_name));
else
System.loadLibrary(lib_name);
return null;
}
});
}
/**
* Public no-arg constructor.