From 2a0e874ab29dc6605b0334d0daf430cab95596dd Mon Sep 17 00:00:00 2001 From: mikedeboer Date: Fri, 17 Sep 2010 12:27:35 +0200 Subject: [PATCH] removed simulated statvfs --- lib/DAV/fs/directory.js | 39 ++------------------------------------- 1 file changed, 2 insertions(+), 37 deletions(-) diff --git a/lib/DAV/fs/directory.js b/lib/DAV/fs/directory.js index 1f54f6b9..c2481025 100644 --- a/lib/DAV/fs/directory.js +++ b/lib/DAV/fs/directory.js @@ -17,43 +17,6 @@ var jsDAV = require("./../../jsdav"), Async = require("./../../../vendor/async.js/lib/async/index"), Exc = require("./../exceptions"); -if (!("statvfs" in Fs)) { - Fs.statvfs = function(path, cbvstatfs) { - var dirSizes = [0], - blkSize = 0; - function beforeRecurse(file) { - if (file.stat.isDirectory()) - dirSizes.push(0); - return true; - } - - Async.walkfiles(path, beforeRecurse, Async.POSTORDER) - .stat() - .each(function(file) { - if (file.stat.isDirectory()) - var size = dirSizes.pop(); - else { - size = file.stat.blocks; - if (!blkSize) - blkSize = file.stat.blksize; - } - if (dirSizes.length) - dirSizes[dirSizes.length - 1] += size - }) - .end(function(err) { - var blocks = 0; - for (var i = 0, l = dirSizes.length; i < l; ++i) - blocks += dirSizes[i]; - cbvstatfs(err, { - blocks: blocks, - bavail: 0, - bfree : 0, - bsize : blkSize - }); - }); - }; -} - function jsDAV_FS_Directory(path) { this.path = path; } @@ -145,6 +108,8 @@ exports.jsDAV_FS_Directory = jsDAV_FS_Directory; * @return array */ this.getQuotaInfo = function(cbfsquota) { + if (!("statvfs" in Fs)) + return cbfsquota(null, [0, 0]); if (this.$statvfs) { return cbfsquota(null, [ (this.$statvfs.blocks - this.$statvfs.bfree),// * this.$statvfs.bsize,