mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-20 18:18:56 +00:00
added ability to get directory size, when space button is pressed and current file is directory.
This commit is contained in:
parent
d91c8dc97c
commit
c918e0fbce
6 changed files with 57 additions and 12 deletions
|
|
@ -41,23 +41,34 @@
|
|||
fs.readdir(pDir, function(pError, pFiles) {
|
||||
lAsyncRunning--;
|
||||
|
||||
var lDirPath, n;
|
||||
|
||||
if (!pError){
|
||||
lFileCounter += pFiles.length;
|
||||
n = pFiles.length;
|
||||
lFileCounter += n;
|
||||
|
||||
var lDirPath;
|
||||
for (var i = 0, n = pFiles.length; i < n; i++) {
|
||||
for (var i = 0; i < n; i++) {
|
||||
lDirPath = path.join(pDir, pFiles[i]);
|
||||
getDirSize(lDirPath);
|
||||
}
|
||||
}
|
||||
|
||||
if(!n)
|
||||
execCallBack();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (!lFileCounter && !lAsyncRunning)
|
||||
pCallBack(null, lTotal);
|
||||
});
|
||||
execCallBack();
|
||||
});
|
||||
}
|
||||
|
||||
function execCallBack(){
|
||||
if (!lFileCounter && !lAsyncRunning){
|
||||
console.log(lTotal);
|
||||
pCallBack(null, lTotal);
|
||||
}
|
||||
}
|
||||
|
||||
return getDirSize(pDir);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -103,6 +103,7 @@
|
|||
dir.getSize(p.name, function(pErr, pSize){
|
||||
if(!pErr){
|
||||
var lSize = CloudFunc.getShortSize(pSize);
|
||||
console.log(lSize);
|
||||
main.sendResponse(pParams, lSize);
|
||||
}
|
||||
else
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue