Allow the resource manager to be run in "don't unpack yer bundles" mode.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3996 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -226,6 +226,11 @@ public class ResourceManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// check to see if we're in developer mode in which case we won't
|
||||||
|
// unpack our resources
|
||||||
|
_unpack = !"true".equalsIgnoreCase(
|
||||||
|
System.getProperty("no_unpack_resources"));
|
||||||
|
|
||||||
// make sure there's a trailing slash
|
// make sure there's a trailing slash
|
||||||
if (!resourceDir.endsWith(File.separator)) {
|
if (!resourceDir.endsWith(File.separator)) {
|
||||||
resourceDir += File.separator;
|
resourceDir += File.separator;
|
||||||
@@ -322,7 +327,7 @@ public class ResourceManager
|
|||||||
public boolean checkBundle (String path)
|
public boolean checkBundle (String path)
|
||||||
{
|
{
|
||||||
return new ResourceBundle(
|
return new ResourceBundle(
|
||||||
getResourceFile(path), true, true).isUnpacked();
|
getResourceFile(path), true, _unpack).isUnpacked();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -336,7 +341,7 @@ public class ResourceManager
|
|||||||
public void resolveBundle (String path, final ResultListener listener)
|
public void resolveBundle (String path, final ResultListener listener)
|
||||||
{
|
{
|
||||||
final ResourceBundle bundle =
|
final ResourceBundle bundle =
|
||||||
new ResourceBundle(getResourceFile(path), true, true);
|
new ResourceBundle(getResourceFile(path), true, _unpack);
|
||||||
if (bundle.isUnpacked()) {
|
if (bundle.isUnpacked()) {
|
||||||
if (bundle.sourceIsReady()) {
|
if (bundle.sourceIsReady()) {
|
||||||
listener.requestCompleted(bundle);
|
listener.requestCompleted(bundle);
|
||||||
@@ -563,7 +568,7 @@ public class ResourceManager
|
|||||||
while (tok.hasMoreTokens()) {
|
while (tok.hasMoreTokens()) {
|
||||||
String path = tok.nextToken().trim();
|
String path = tok.nextToken().trim();
|
||||||
ResourceBundle bundle =
|
ResourceBundle bundle =
|
||||||
new ResourceBundle(getResourceFile(path), true, true);
|
new ResourceBundle(getResourceFile(path), true, _unpack);
|
||||||
set.add(bundle);
|
set.add(bundle);
|
||||||
if (bundle.isUnpacked() && bundle.sourceIsReady()) {
|
if (bundle.isUnpacked() && bundle.sourceIsReady()) {
|
||||||
continue;
|
continue;
|
||||||
@@ -634,6 +639,9 @@ public class ResourceManager
|
|||||||
* them from the classpath. */
|
* them from the classpath. */
|
||||||
protected String _rootPath;
|
protected String _rootPath;
|
||||||
|
|
||||||
|
/** Whether or not to unpack our resource bundles. */
|
||||||
|
protected boolean _unpack;
|
||||||
|
|
||||||
/** Our default resource set. */
|
/** Our default resource set. */
|
||||||
protected ResourceBundle[] _default = new ResourceBundle[0];
|
protected ResourceBundle[] _default = new ResourceBundle[0];
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user