Ignore dotfiles and dot-directories. TM #210 related.

nohash
Tom MacWright 14 years ago
parent 60d519863e
commit 7c1cea7f0a

@ -124,6 +124,8 @@ External.prototype.findOneByExtension = function(ext, callback) {
this.findByExtension(ext, cb);
}
// Find a file by extension in `this.path()`.
// Ignores .directories and .files
External.prototype.findByExtension = function(ext, callback) {
var running = 0;
var found = [];
@ -138,6 +140,8 @@ External.prototype.findByExtension = function(ext, callback) {
i;
}
files.forEach(function(file) {
// Ignore dotfiles and dot-directories
if (file[0] === '.') return;
running++;
file = path.join(dir, file);
fs.stat(file, function(err, stats) {

@ -75,3 +75,13 @@ exports['test External with remote KML file'] = function(beforeExit) {
helper.md5File(external.path(), 'f8aea6d693a48dabdc7ea3586cce57f7', context);
});
};
exports['test External with DS_Store'] = function(beforeExit) {
new External(env, 'http://tilemill-testing.s3.amazonaws.com/carto/station_circles_bad.zip')
.on('complete', function(external) {
assert.ok(external instanceof External);
external.findDataFile(function(err, file) {
assert.eql('station_circles.shp', path.basename(file), 'The non-dot file was chosen');
});
});
};

Loading…
Cancel
Save