Skip to content

Commit

Permalink
removed simulated statvfs
Browse files Browse the repository at this point in the history
  • Loading branch information
mikedeboer committed Sep 17, 2010
1 parent c850113 commit 2a0e874
Showing 1 changed file with 2 additions and 37 deletions.
39 changes: 2 additions & 37 deletions lib/DAV/fs/directory.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 2a0e874

Please sign in to comment.