summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2010-07-11 10:29:21 +1200
committerLars Wirzenius <liw@liw.fi>2010-07-11 10:29:21 +1200
commitc63c041421c3ef40bb7e95922a28f1943ba0fc81 (patch)
tree8f271c11ca09dd0a94199096dd1a22dd79d5030f
parent7d31bc7228944650a9e89f8ef42f3b0b3f9c8f37 (diff)
downloadobnam-c63c041421c3ef40bb7e95922a28f1943ba0fc81.tar.gz
Fix _write_helper to create only parent directory.
-rw-r--r--obnamlib/plugins/sftp_plugin.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/obnamlib/plugins/sftp_plugin.py b/obnamlib/plugins/sftp_plugin.py
index dbce9b6d..e961e38c 100644
--- a/obnamlib/plugins/sftp_plugin.py
+++ b/obnamlib/plugins/sftp_plugin.py
@@ -245,7 +245,9 @@ class SftpFS(obnamlib.VirtualFileSystem):
self._write_helper(pathname, 'w', contents)
def _write_helper(self, pathname, mode, contents):
- self.makedirs(pathname)
+ dirname = os.path.dirname(pathname)
+ if dirname:
+ self.makedirs(dirname)
f = self.open(pathname, mode)
chunk_size = 32 * 1024
for pos in range(0, len(contents), chunk_size):