refactor(rest, cloudcmd) getDirContent

This commit is contained in:
coderaiser 2014-03-05 06:21:50 -05:00
parent dd315361da
commit 09a1c7169e
2 changed files with 7 additions and 10 deletions

View file

@ -251,12 +251,12 @@
function getContent(name, callback) {
fs.stat(name, function(error, stat) {
var isFile,
isDir = stat && stat.isDirectory(),
func = Util.retExec(callback);
var getDirContent = main.commander.getDirContent,
isDir = stat && stat.isDirectory(),
func = Util.retExec(callback);
if (!error && isDir)
main.commander.getDirContent(name, callback);
getDirContent(name, callback);
else
func(error, null, !isDir);
});

View file

@ -344,13 +344,10 @@
var getDirContent = main.commander.getDirContent,
isDir = stat && stat.isDirectory();
if (error)
func(error);
if (isDir && !error)
getDirContent(name, func);
else
if (!isDir)
func(null, null, !isDir);
else
getDirContent(name, func);
func(error, null, !isDir);
});
break;
}