From 529e86621b453c7649e35b46601deb1899b8974f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jarno=20Sepp=C3=A4nen?= Date: Fri, 2 May 2014 21:34:32 +0300 Subject: [PATCH] Show number of files as directory size --- gpgfs.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gpgfs.py b/gpgfs.py index 4accacf..48bea82 100755 --- a/gpgfs.py +++ b/gpgfs.py @@ -282,7 +282,8 @@ class GpgFs(LoggingMixIn, Operations): def getattr(self, path, fh = None): ent = self._find(path) 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_atime = 0, st_nlink = 3) # ensure st_size is up-to-date @@ -405,7 +406,7 @@ class GpgFs(LoggingMixIn, Operations): ent = self._find(path) encpath = self.encroot + '/' + ent.path if length == 0: - with open(encpath+'.new', 'w') as f: + with open(encpath+'.new', 'w'): pass else: buf = decrypt(self.gpg, encpath)