mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-19 09:24:51 +00:00
refactor(rest, cloudcmd) getDirContent
This commit is contained in:
parent
dd315361da
commit
09a1c7169e
2 changed files with 7 additions and 10 deletions
|
|
@ -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);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue