added ability to get directory size, when space button is pressed and current file is directory.

This commit is contained in:
coderaiser 2013-04-08 03:35:46 -04:00
parent d91c8dc97c
commit c918e0fbce
6 changed files with 57 additions and 12 deletions

View file

@ -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);
};

View file

@ -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