Empty directory bug fixed (#179)

added the check to test if the directory is empty by comparing it's length with 0.
This commit is contained in:
mayank1010
2018-02-22 01:25:24 +05:30
committed by Jeffrey Warren
parent 0fd797ed5a
commit d3a4c336a0

View File

@@ -2,7 +2,7 @@ var fs = require('fs');
var getDirectories = function(rootDir, cb) {
fs.readdir(rootDir, function(err, files) {
var dirs = [];
if(typeof(files)=="undefined") {
if(typeof(files)=="undefined" || files.length == 0) {
cb(dirs);
return [];
}