summaryrefslogtreecommitdiff
path: root/fs/base.py
diff options
context:
space:
mode:
Diffstat (limited to 'fs/base.py')
-rw-r--r--fs/base.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/fs/base.py b/fs/base.py
index c1c363d..8e2686e 100644
--- a/fs/base.py
+++ b/fs/base.py
@@ -895,15 +895,15 @@ class FS(object):
:param wipe: if True, the contents of the file will be erased
"""
- if not wipe and self.isfile(path):
- return
-
- f = None
- try:
- f = self.open(path, 'w')
- finally:
- if f is not None:
- f.close()
+ with self._lock:
+ if not wipe and self.isfile(path):
+ return
+ f = None
+ try:
+ f = self.open(path, 'wb')
+ finally:
+ if f is not None:
+ f.close()
def opendir(self, path):
"""Opens a directory and returns a FS object representing its contents.