refactor(size) onReaddir: rm error

This commit is contained in:
coderaiser 2014-11-19 07:22:24 -05:00
parent 4debada2db
commit 40d3c596e1

View file

@ -94,7 +94,12 @@
++asyncRunning;
fs.readdir(dir, function(error, files) {
onReaddir(error, files, dir);
if (error && stopOnError) {
wasError = true;
emitter.emit('error', error);
} else {
onReaddir(dir, files);
}
});
}
}
@ -103,15 +108,16 @@
}
}
function onReaddir(error, files, dir) {
var n;
function onReaddir(dir, files) {
var n = files.length;
asyncRunning--;
if (!error) {
n = files.length;
fileCounter += n;
fileCounter += n;
if (!n)
execCallBack();
else
files.forEach(function(file) {
var dirPath = path.join(dir, file);
@ -119,10 +125,6 @@
getDirInfo(dirPath);
});
});
}
if (!n)
execCallBack();
}
}