From 7c67df8e3711d3d88d83db73bf279fde7be5035d Mon Sep 17 00:00:00 2001 From: Andrzej Kapolka Date: Fri, 23 May 2008 19:30:47 +0000 Subject: [PATCH] Made the initResourceDir method public so that we can reconfigure the resource directory in tools. git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@504 ed5b42cb-e716-0410-a449-f6a68f950b19 --- .../threerings/resource/ResourceManager.java | 52 +++++++++++-------- 1 file changed, 29 insertions(+), 23 deletions(-) diff --git a/src/java/com/threerings/resource/ResourceManager.java b/src/java/com/threerings/resource/ResourceManager.java index a85d0c8c..04097392 100644 --- a/src/java/com/threerings/resource/ResourceManager.java +++ b/src/java/com/threerings/resource/ResourceManager.java @@ -321,6 +321,35 @@ public class ResourceManager } } + /** + * (Re)initializes the directory to search for resource files. + * + * @param resourceDir the directory path, or null to set the resource dir to + * the value of the resource_dir system property. + */ + public void initResourceDir (String resourceDir) + { + // if none was specified, check the resource_dir system property + if (resourceDir == null) { + try { + resourceDir = System.getProperty("resource_dir"); + } catch (SecurityException se) { + // no problem + } + } + + // if we found no resource directory, don't use one + if (resourceDir == null) { + return; + } + + // make sure there's a trailing slash + if (!resourceDir.endsWith(File.separator)) { + resourceDir += File.separator; + } + _rdir = new File(resourceDir); + } + /** * Given a path relative to the resource directory, the path is properly jimmied (assuming we * always use /) and combined with the resource directory to yield a {@link File} object that @@ -665,29 +694,6 @@ public class ResourceManager { return null; } - - protected void initResourceDir (String resourceDir) - { - // if none was specified, check the resource_dir system property - if (resourceDir == null) { - try { - resourceDir = System.getProperty("resource_dir"); - } catch (SecurityException se) { - // no problem - } - } - - // if we found no resource directory, don't use one - if (resourceDir == null) { - return; - } - - // 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.