]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
Extend get_pathinfo to add size, ctime and mtime.
authorDaira Hopwood <daira@jacaranda.org>
Tue, 11 Aug 2015 15:02:25 +0000 (16:02 +0100)
committerDaira Hopwood <daira@jacaranda.org>
Tue, 11 Aug 2015 15:02:25 +0000 (16:02 +0100)
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
src/allmydata/util/fileutil.py

index cd423c5841aa671244289c72270d4ce513989d7c..97ef09b78d6d496f6eabedabfc2d8839aa5a270c 100644 (file)
@@ -625,7 +625,7 @@ else:
             reraise(ConflictError)
 
 
-PathInfo = namedtuple('PathInfo', 'isdir isfile islink exists')
+PathInfo = namedtuple('PathInfo', 'isdir isfile islink exists size ctime mtime')
 
 def get_pathinfo(path_u):
     try:
@@ -634,11 +634,19 @@ def get_pathinfo(path_u):
         return PathInfo(isdir =stat.S_ISDIR(mode),
                         isfile=stat.S_ISREG(mode),
                         islink=stat.S_ISLNK(mode),
-                        exists=True)
+                        exists=True,
+                        size  =statinfo.st_size,
+                        ctime =statinfo.st_ctime,
+                        mtime =statinfo.st_mtime,
+                       )
     except OSError as e:
         if e.errno == ENOENT:
             return PathInfo(isdir=False,
                             isfile=False,
                             islink=False,
-                            exists=False)
+                            exists=False,
+                            size  =None,
+                            ctime =None,
+                            mtime =None,
+                           )
         raise