diff --git a/src/java/com/threerings/cast/bundle/BundleUtil.java b/src/java/com/threerings/cast/bundle/BundleUtil.java index 66764576d..a8dc91abd 100644 --- a/src/java/com/threerings/cast/bundle/BundleUtil.java +++ b/src/java/com/threerings/cast/bundle/BundleUtil.java @@ -1,5 +1,5 @@ // -// $Id: BundleUtil.java,v 1.9 2004/08/27 02:12:27 mdb Exp $ +// $Id: BundleUtil.java,v 1.10 2004/10/18 21:39:18 mdb Exp $ // // Narya library - tools for developing networked games // Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved @@ -99,7 +99,7 @@ public class BundleUtil if (wipeBundleOnFailure) { StreamUtil.close(bin); bin = null; - bundle.wipeBundle(); + bundle.wipeBundle(false); } throw ioe; diff --git a/src/java/com/threerings/cast/bundle/BundledComponentRepository.java b/src/java/com/threerings/cast/bundle/BundledComponentRepository.java index 5d89c1a5f..50a51ccf6 100644 --- a/src/java/com/threerings/cast/bundle/BundledComponentRepository.java +++ b/src/java/com/threerings/cast/bundle/BundledComponentRepository.java @@ -1,5 +1,5 @@ // -// $Id: BundledComponentRepository.java,v 1.34 2004/08/27 02:12:27 mdb Exp $ +// $Id: BundledComponentRepository.java,v 1.35 2004/10/18 21:39:18 mdb Exp $ // // Narya library - tools for developing networked games // Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved @@ -156,6 +156,18 @@ public class BundledComponentRepository } } + /** + * Configures the bundled component repository to wipe any bundles + * that report certain kinds of failure. In the event that an unpacked + * bundle becomes corrupt, this is useful in that it will force the + * bundle to be unpacked on the next application invocation, + * potentially remedying the problem of a corrupt unpacking. + */ + public void setWipeOnFailure (boolean wipeOnFailure) + { + _wipeOnFailure = true; + } + // documentation inherited public CharacterComponent getComponent (int componentId) throws NoSuchComponentException @@ -332,6 +344,9 @@ public class BundledComponentRepository if (aset == null) { Log.warning("Unable to locate tileset for action '" + action + "' " + component + "."); + if (_wipeOnFailure) { + _bundle.wipeBundle(false); + } return null; } @@ -504,4 +519,7 @@ public class BundledComponentRepository /** The component table. */ protected HashIntMap _components = new HashIntMap(); + + /** Whether or not we wipe our bundles on any failure. */ + protected boolean _wipeOnFailure; }