aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorelias <[email protected]>2006-07-14 08:31:27 +0000
committerelias <[email protected]>2006-07-14 08:31:27 +0000
commit231c94ae0be37b163c04b3b76f59ad11e09e61d8 (patch)
tree74bb30e91a189bc111921d8eede824e9b4f6271b /plugins
parentd3c30eca1f2bb9643587c8aac9c71966ceb5b3a1 (diff)
Made the core classes and the linux plugin applet compatible. Removed dead code in DefaultControllerEnvironment
git-svn-id: file:///home/sven/projects/JOGL/git-svn/svn-server-sync/jinput/trunk@153 e343933a-64c8-49c5-92b1-88f2ce3e89e8
Diffstat (limited to 'plugins')
-rw-r--r--plugins/linux/src/java/net/java/games/input/LinuxEnvironmentPlugin.java32
1 files changed, 25 insertions, 7 deletions
diff --git a/plugins/linux/src/java/net/java/games/input/LinuxEnvironmentPlugin.java b/plugins/linux/src/java/net/java/games/input/LinuxEnvironmentPlugin.java
index 69ab966..513c85d 100644
--- a/plugins/linux/src/java/net/java/games/input/LinuxEnvironmentPlugin.java
+++ b/plugins/linux/src/java/net/java/games/input/LinuxEnvironmentPlugin.java
@@ -296,7 +296,8 @@ public final class LinuxEnvironmentPlugin extends ControllerEnvironment implemen
for (int i = 0; i < joystick_device_files.length; i++) {
File event_file = joystick_device_files[i];
try {
- LinuxJoystickDevice device = new LinuxJoystickDevice(event_file.getAbsolutePath());
+ String path = getAbsolutePathPrivileged(event_file);
+ LinuxJoystickDevice device = new LinuxJoystickDevice(path);
Controller controller = createJoystickFromJoystickDevice(device);
if (controller != null) {
controllers.add(controller);
@@ -309,18 +310,34 @@ public final class LinuxEnvironmentPlugin extends ControllerEnvironment implemen
}
}
- private final static File[] enumerateJoystickDeviceFiles(String dev_path) {
- File dev = new File(dev_path);
- return dev.listFiles(new FilenameFilter() {
+ private final static File[] enumerateJoystickDeviceFiles(final String dev_path) {
+ final File dev = new File(dev_path);
+ return listFilesPrivileged(dev, new FilenameFilter() {
public final boolean accept(File dir, String name) {
return name.startsWith("js");
}
});
}
+ private static String getAbsolutePathPrivileged(final File file) {
+ return (String)AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ return file.getAbsolutePath();
+ }
+ });
+ }
+
+ private static File[] listFilesPrivileged(final File dir, final FilenameFilter filter) {
+ return (File[])AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ return dir.listFiles(filter);
+ }
+ });
+ }
+
private final void enumerateEventControllers(List controllers) {
- File dev = new File("/dev/input");
- File[] event_device_files = dev.listFiles(new FilenameFilter() {
+ final File dev = new File("/dev/input");
+ File[] event_device_files = listFilesPrivileged(dev, new FilenameFilter() {
public final boolean accept(File dir, String name) {
return name.startsWith("event");
}
@@ -330,7 +347,8 @@ public final class LinuxEnvironmentPlugin extends ControllerEnvironment implemen
for (int i = 0; i < event_device_files.length; i++) {
File event_file = event_device_files[i];
try {
- LinuxEventDevice device = new LinuxEventDevice(event_file.getAbsolutePath());
+ String path = getAbsolutePathPrivileged(event_file);
+ LinuxEventDevice device = new LinuxEventDevice(path);
try {
Controller controller = createControllerFromDevice(device);
if (controller != null) {