summaryrefslogtreecommitdiff
path: root/fs/zipfs.py
diff options
context:
space:
mode:
authorwillmcgugan <willmcgugan@67cdc799-7952-0410-af00-57a81ceafa0f>2008-09-16 11:47:46 +0000
committerwillmcgugan <willmcgugan@67cdc799-7952-0410-af00-57a81ceafa0f>2008-09-16 11:47:46 +0000
commit51f6d0062cde94a19603137a3b7c07d87b356943 (patch)
treec373d37470612a2f8bb6bd33d7bacc86ad8cbfbc /fs/zipfs.py
parent1fd5453afc40a8a9a4eb2a3591b684681c9500b9 (diff)
downloadpyfilesystem-git-51f6d0062cde94a19603137a3b7c07d87b356943.tar.gz
Added a thread lock to makedir
Diffstat (limited to 'fs/zipfs.py')
-rw-r--r--fs/zipfs.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/fs/zipfs.py b/fs/zipfs.py
index 98f9e6b..171f810 100644
--- a/fs/zipfs.py
+++ b/fs/zipfs.py
@@ -172,12 +172,16 @@ class ZipFS(FS):
return self._path_fs.exists(path)
def makedir(self, dirname, mode=0777, recursive=False, allow_recreate=False):
- dirname = normpath(dirname)
- if self.zip_mode not in "wa":
- raise OperationFailedError("MAKEDIR_FAILED", dirname, "Zip file must be opened for writing ('w') or appending ('a')")
- if not dirname.endswith('/'):
- dirname += '/'
- self._add_resource(dirname)
+ self._lock.acquire()
+ try:
+ dirname = normpath(dirname)
+ if self.zip_mode not in "wa":
+ raise OperationFailedError("MAKEDIR_FAILED", dirname, "Zip file must be opened for writing ('w') or appending ('a')")
+ if not dirname.endswith('/'):
+ dirname += '/'
+ self._add_resource(dirname)
+ finally:
+ self._lock.release()
def listdir(self, path="/", wildcard=None, full=False, absolute=False, hidden=False, dirs_only=False, files_only=False):