Throw a sensible error message if we choke trimming a tileset.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2214 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2003-01-24 19:32:56 +00:00
parent cc680cbd17
commit 18d0266055
@@ -1,5 +1,5 @@
// //
// $Id: TileSetBundler.java,v 1.10 2003/01/13 22:49:47 mdb Exp $ // $Id: TileSetBundler.java,v 1.11 2003/01/24 19:32:56 mdb Exp $
package com.threerings.media.tile.bundle.tools; package com.threerings.media.tile.bundle.tools;
@@ -308,26 +308,36 @@ public class TileSetBundler
jar.putNextEntry(new JarEntry(imagePath)); jar.putNextEntry(new JarEntry(imagePath));
// if this is an object tileset, we can't trim it! // if this is an object tileset, we can't trim it!
if (set instanceof ObjectTileSet) { try {
// set the tileset up with an image provider; we need to if (set instanceof ObjectTileSet) {
// do this so that we can trim it! // set the tileset up with an image provider; we
set.setImageProvider(improv); // need to do this so that we can trim it!
set.setImageProvider(improv);
// create a trimmed object tileset, which will write // create a trimmed object tileset, which will
// the trimmed tileset image to the jar output stream // write the trimmed tileset image to the jar
TrimmedObjectTileSet tset = // output stream
TrimmedObjectTileSet.trimObjectTileSet( System.out.println("Trimming " + imagePath);
(ObjectTileSet)set, jar); TrimmedObjectTileSet tset =
tset.setImagePath(imagePath); TrimmedObjectTileSet.trimObjectTileSet(
// replace the original set with the trimmed tileset (ObjectTileSet)set, jar);
// in the tileset bundle tset.setImagePath(imagePath);
bundle.addTileSet(tileSetId, tset); // replace the original set with the trimmed
// tileset in the tileset bundle
bundle.addTileSet(tileSetId, tset);
} else { } else {
// open the image and pipe it into the jar file // open the image and pipe it into the jar file
File imgfile = new File(bundleDesc.getParent(), imagePath); File imgfile = new File(bundleDesc.getParent(),
FileInputStream imgin = new FileInputStream(imgfile); imagePath);
StreamUtils.pipe(imgin, jar); FileInputStream imgin = new FileInputStream(imgfile);
StreamUtils.pipe(imgin, jar);
}
} catch (Exception e) {
String errmsg = "Error adding tileset to bundle " +
"[set=" + set.getName() + ", ipath=" + imagePath + "]";
throw (IOException)new IOException(errmsg).initCause(e);
} }
} }