From 69ce5cfed0b0efa0d573f1bcdbfad68fa7b2fce3 Mon Sep 17 00:00:00 2001 From: Evan Broder Date: Thu, 19 Nov 2009 02:55:34 -0500 Subject: [PATCH] Add an fs.inafs function for determining if a path is in AFS at all. Signed-off-by: Evan Broder --- afs/fs.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/afs/fs.py b/afs/fs.py index 0044c05..a90cd4c 100644 --- a/afs/fs.py +++ b/afs/fs.py @@ -1,2 +1,13 @@ +import errno import _fs from _fs import whichcell + +def inafs(path): + """Return True if a path is in AFS.""" + try: + whichcell(path) + except OSError, e: + if e.errno in (errno.EINVAL, errno.ENOENT): + return False + + return True -- 1.7.9.5