summaryrefslogtreecommitdiff
path: root/fs/helpers.py
diff options
context:
space:
mode:
authorrfkelly0 <rfkelly0@67cdc799-7952-0410-af00-57a81ceafa0f>2009-06-03 05:30:56 +0000
committerrfkelly0 <rfkelly0@67cdc799-7952-0410-af00-57a81ceafa0f>2009-06-03 05:30:56 +0000
commit987074ae41aaa3efc17496278a9ec5720d6cae36 (patch)
treea6d067f2e705308360ec212d6d525ef39d576781 /fs/helpers.py
parent3ac95c055463eb73f552c91e2894a7d8888aa1bf (diff)
downloadpyfilesystem-git-987074ae41aaa3efc17496278a9ec5720d6cae36.tar.gz
Added SFTPFS class, for accessing SFTP servers via paramiko
Diffstat (limited to 'fs/helpers.py')
-rw-r--r--fs/helpers.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/fs/helpers.py b/fs/helpers.py
index e47082b..f88b17e 100644
--- a/fs/helpers.py
+++ b/fs/helpers.py
@@ -202,3 +202,18 @@ def issamedir(path1, path2):
return pathsplit(normpath(path1))[0] == pathsplit(normpath(path2))[0]
+def isprefix(path1,path2):
+ """Return true is path1 is a prefix of path2."""
+ bits1 = path1.split("/")
+ bits2 = path2.split("/")
+ while bits1 and bits1[-1] == "":
+ bits1.pop()
+ if len(bits1) > len(bits2):
+ return False
+ for (bit1,bit2) in zip(bits1,bits2):
+ if bit1 != bit2:
+ return False
+ return True
+
+
+