From e74970ac1eefb25df648b116e1736d9463bcad1a Mon Sep 17 00:00:00 2001 From: Mike Thomas Date: Sat, 2 Dec 2006 01:41:28 +0000 Subject: [PATCH] Also need to adjust the path to find localized resource files if we come through the getResource/getImageResource calls that pass us a resource set. git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@85 ed5b42cb-e716-0410-a449-f6a68f950b19 --- .../threerings/resource/ResourceManager.java | 25 +++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/java/com/threerings/resource/ResourceManager.java b/src/java/com/threerings/resource/ResourceManager.java index e1d764b3..197d2cb4 100644 --- a/src/java/com/threerings/resource/ResourceManager.java +++ b/src/java/com/threerings/resource/ResourceManager.java @@ -548,7 +548,17 @@ public class ResourceManager // look for the resource in any of the bundles int size = bundles.length; for (int ii = 0; ii < size; ii++) { - InputStream instr = bundles[ii].getResource(path); + InputStream instr = null; + + // Try a localized version first. + if (_localePrefix != null) { + instr = bundles[ii].getResource( + PathUtil.appendPath(_localePrefix, path)); + } + // If we didn't find that, try a generic. + if (instr == null) { + instr = bundles[ii].getResource(path); + } if (instr != null) { // Log.info("Found resource [rset=" + rset + // ", bundle=" + bundles[ii].getSource().getPath() + @@ -586,7 +596,18 @@ public class ResourceManager // look for the resource in any of the bundles int size = bundles.length; for (int ii = 0; ii < size; ii++) { - File file = bundles[ii].getResourceFile(path); + File file = null; + // Try a localized version first. + if (_localePrefix != null) { + file = bundles[ii].getResourceFile( + PathUtil.appendPath(_localePrefix, path)); + } + + // If we didn't find that, try generic. + if (file == null) { + file = bundles[ii].getResourceFile(path); + } + if (file != null) { // Log.info("Found image resource [rset=" + rset + // ", bundle=" + bundles[ii].getSource() +