From eef6b392d8a8c58c6b0e7fd5c7d1165241f8e030 Mon Sep 17 00:00:00 2001 From: willmcgugan Date: Fri, 19 Sep 2008 16:17:55 +0000 Subject: Fixes for zipfs and copydir --- fs/zipfs.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'fs/zipfs.py') diff --git a/fs/zipfs.py b/fs/zipfs.py index 2e5dfaf..cfe383f 100644 --- a/fs/zipfs.py +++ b/fs/zipfs.py @@ -72,7 +72,10 @@ class ZipFS(FS): raise ValueError("mode must be 'r', 'w' or 'a'") self.zip_mode = mode - self.zf = ZipFile(zip_file, mode, compression_type, allowZip64) + try: + self.zf = ZipFile(zip_file, mode, compression_type, allowZip64) + except IOError: + raise ResourceNotFoundError("NO_FILE", "Zip file does not exist: %(path)s") self.zip_path = str(zip_file) self.temp_fs = None @@ -96,7 +99,8 @@ class ZipFS(FS): def _add_resource(self, path): if path.endswith('/'): path = path[:-1] - self._path_fs.makedir(path, recursive=True, allow_recreate=True) + if path: + self._path_fs.makedir(path, recursive=True, allow_recreate=True) else: dirpath, filename = pathsplit(path) if dirpath: -- cgit v1.2.1