Cleanup of unzip, still need to rewrite locateShp

This commit is contained in:
Tom MacWright 2011-01-23 18:59:42 -05:00
parent c63e009acb
commit 80aff7b18a

View File

@ -267,7 +267,7 @@ var External = function External(env) {
var zf = new zip.ZipFile(filename);
var dirname = that.pos(resource_url);
Step(
function uncompress_all() {
function() {
var group = this.group();
zf.names.forEach(function(name) {
var uncompressed = path.join(dirname,name);
@ -284,15 +284,17 @@ var External = function External(env) {
fs.writeSync(fd, buffer, 0, buffer.length, null);
fs.closeSync(fd);
}
g();
g(null, uncompressed);
})
});
},
function finish_up(err) {
if (err) throw err;
callback(null, [
resource_url,
that.locateShp(dirname)]);
function(err, results) {
// TODO: simplify locateShp but also
// allow non-redownloading of shapefiles.
err && callback(err);
callback(null, [
resource_url,
that.locateShp(dirname)]);
}
);
}