Show number of files as directory size

This commit is contained in:
Jarno Seppänen 2014-05-02 21:34:32 +03:00
parent 9aff59979d
commit 529e86621b
1 changed files with 3 additions and 2 deletions

View File

@ -282,7 +282,8 @@ class GpgFs(LoggingMixIn, Operations):
def getattr(self, path, fh = None): def getattr(self, path, fh = None):
ent = self._find(path) ent = self._find(path)
if ent.type == ENT_DIR: if ent.type == ENT_DIR:
return dict(st_mode = stat.S_IFDIR | ent.st_mode, st_size = 0, return dict(st_mode = stat.S_IFDIR | ent.st_mode,
st_size = len(ent.children),
st_ctime = ent.st_ctime, st_mtime = ent.st_mtime, st_ctime = ent.st_ctime, st_mtime = ent.st_mtime,
st_atime = 0, st_nlink = 3) st_atime = 0, st_nlink = 3)
# ensure st_size is up-to-date # ensure st_size is up-to-date
@ -405,7 +406,7 @@ class GpgFs(LoggingMixIn, Operations):
ent = self._find(path) ent = self._find(path)
encpath = self.encroot + '/' + ent.path encpath = self.encroot + '/' + ent.path
if length == 0: if length == 0:
with open(encpath+'.new', 'w') as f: with open(encpath+'.new', 'w'):
pass pass
else: else:
buf = decrypt(self.gpg, encpath) buf = decrypt(self.gpg, encpath)