diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/java/net/java/games/util/plugins/Plugins.java | 10 | ||||
-rw-r--r-- | src/java/net/java/games/util/plugins/test/PluginTest.java | 9 |
2 files changed, 15 insertions, 4 deletions
diff --git a/src/java/net/java/games/util/plugins/Plugins.java b/src/java/net/java/games/util/plugins/Plugins.java index 7a7e5f4..87e6146 100644 --- a/src/java/net/java/games/util/plugins/Plugins.java +++ b/src/java/net/java/games/util/plugins/Plugins.java @@ -69,12 +69,16 @@ public class Plugins { * @param pluginRoot The root od the directory tree to scan for Jars * containing plugins. */ - public Plugins(File pluginRoot) { - scanPlugins(pluginRoot); + public Plugins(File pluginRoot) throws IOException { + scanPlugins(pluginRoot); } - private void scanPlugins(File dir) { + private void scanPlugins(File dir) throws IOException { File[] files = dir.listFiles(); + if (files == null) { + throw new FileNotFoundException("Plugin directory "+dir.getName()+ + " not found."); + } for(int i=0;i<files.length;i++){ File f = files[i]; if (f.getName().endsWith(".jar")) { // process JAR file diff --git a/src/java/net/java/games/util/plugins/test/PluginTest.java b/src/java/net/java/games/util/plugins/test/PluginTest.java index a5ea39d..af7ef82 100644 --- a/src/java/net/java/games/util/plugins/test/PluginTest.java +++ b/src/java/net/java/games/util/plugins/test/PluginTest.java @@ -82,11 +82,18 @@ class ListUpdater implements Runnable{ public class PluginTest { static final boolean DEBUG = false; - Plugins plugins = new Plugins(new File("test_plugins")); + + Plugins plugins; JList plist; Class[] piList; // holder for current list of plugins /** Creates a new instance of PluginTest */ public PluginTest() { + try { + plugins = new Plugins(new File("test_plugins")); + } catch (IOException e) { + e.printStackTrace(); + System.exit(1); + } JFrame f = new JFrame("PluginTest"); plist = new JList(new DefaultListModel()); plist.setCellRenderer(new ClassRenderer()); |