diff --git a/src/java/com/threerings/resource/ResourceManager.java b/src/java/com/threerings/resource/ResourceManager.java index 0ed2069d4..1b4f436de 100644 --- a/src/java/com/threerings/resource/ResourceManager.java +++ b/src/java/com/threerings/resource/ResourceManager.java @@ -176,6 +176,9 @@ public class ResourceManager _rootPath = resourceRoot; _loader = loader; + // get our resource directory from resource_dir if possible + initResourceDir(null); + // set up a URL handler so that things can be loaded via urls // with the 'resource' protocol AccessController.doPrivileged(new PrivilegedAction() { @@ -210,20 +213,9 @@ public class ResourceManager String resourceDir, String configPath, InitObserver initObs) throws IOException { - // if the resource directory wasn't provided, we try to figure it - // out for ourselves - if (resourceDir == null) { - try { - // first look for the explicit system property - resourceDir = System.getProperty("resource_dir"); - // if that doesn't work, fall back to the current directory - if (resourceDir == null) { - resourceDir = System.getProperty("user.dir"); - } - - } catch (SecurityException se) { - resourceDir = File.separator; - } + // reinitialize our resource dir if it was specified + if (resourceDir != null) { + initResourceDir(resourceDir); } // check to see if we're in developer mode in which case we won't @@ -231,12 +223,6 @@ public class ResourceManager _unpack = !"true".equalsIgnoreCase( System.getProperty("no_unpack_resources")); - // make sure there's a trailing slash - if (!resourceDir.endsWith(File.separator)) { - resourceDir += File.separator; - } - _rdir = new File(resourceDir); - // load up our configuration Properties config = new Properties(); try { @@ -555,6 +541,29 @@ public class ResourceManager return (ResourceBundle[])_sets.get(name); } + protected void initResourceDir (String resourceDir) + { + if (resourceDir == null) { + try { + // first look for the explicit system property + resourceDir = System.getProperty("resource_dir"); + // if that doesn't work, fall back to the current directory + if (resourceDir == null) { + resourceDir = System.getProperty("user.dir"); + } + + } catch (SecurityException se) { + resourceDir = File.separator; + } + } + + // make sure there's a trailing slash + if (!resourceDir.endsWith(File.separator)) { + resourceDir += File.separator; + } + _rdir = new File(resourceDir); + } + /** * Loads up a resource set based on the supplied definition * information.