Return empty hash from list if directory doesn't exist.

Conflicts:

	test/list.test.js
This commit is contained in:
Will White
2012-03-28 20:27:31 -04:00
committed by Young Hahn
parent 889735db2b
commit 25c2a99d72
2 changed files with 4 additions and 8 deletions

View File

@@ -76,6 +76,7 @@ MBTiles.registerProtocols = function(tilelive) {
MBTiles.list = function(filepath, callback) {
filepath = path.resolve(filepath);
fs.readdir(filepath, function(err, files) {
if (err && err.code === 'ENOENT') return callback(null, {});
if (err) return callback(err);
for (var result = {}, i = 0; i < files.length; i++) {
var name = files[i].match(/^([\w-]+)\.mbtiles$/);