summaryrefslogtreecommitdiff
path: root/fs/contrib
diff options
context:
space:
mode:
authorbtimby <btimby@67cdc799-7952-0410-af00-57a81ceafa0f>2012-03-12 21:25:52 +0000
committerbtimby <btimby@67cdc799-7952-0410-af00-57a81ceafa0f>2012-03-12 21:25:52 +0000
commit83370fc4a72c63b5af57d457b67dc00b7515ee42 (patch)
treeb4f08bcf28985783e81404eeccdd70a851293605 /fs/contrib
parentf4896c9829aaa66215e096bd6fba3d8e3fce4148 (diff)
downloadpyfilesystem-git-83370fc4a72c63b5af57d457b67dc00b7515ee42.tar.gz
Support opening the archive directly
Diffstat (limited to 'fs/contrib')
-rw-r--r--fs/contrib/archivefs.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/contrib/archivefs.py b/fs/contrib/archivefs.py
index b820030..cb6cd77 100644
--- a/fs/contrib/archivefs.py
+++ b/fs/contrib/archivefs.py
@@ -98,6 +98,9 @@ class ArchiveFS(FS):
@synchronize
def open(self, path, mode="r", **kwargs):
path = normpath(relpath(path))
+ if path == '':
+ # We need to open the archive itself, not one of it's entries.
+ return file(self.root_path, mode)
if 'a' in mode:
raise Exception('Unsupported mode ' + mode)
if 'r' in mode:
@@ -114,7 +117,7 @@ class ArchiveFS(FS):
f = self.open(path)
return f.read()
- def desc(self, path):
+ def desc(self, path):
return "%s in zip file" % path
def getsyspath(self, path, allow_none=False):