summaryrefslogtreecommitdiff
path: root/mammoth/zips.py
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2018-01-24 08:35:02 +0000
committerMichael Williamson <mike@zwobble.org>2018-01-24 08:35:02 +0000
commit8f0d1c25178708d6b3878c7a433f07742bbba11c (patch)
tree7fec40361f55352ed1eb044dfe66fef1b6ffbf8b /mammoth/zips.py
parentd4acfff9f5f17630a153f12276fa8a2016052c8b (diff)
Extract code for manipulating zip paths
Diffstat (limited to 'mammoth/zips.py')
-rw-r--r--mammoth/zips.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/mammoth/zips.py b/mammoth/zips.py
index 432be5d..cca0b49 100644
--- a/mammoth/zips.py
+++ b/mammoth/zips.py
@@ -54,3 +54,15 @@ def update_zip(fileobj, files):
fileobj.seek(0)
destination_fileobj.seek(0)
shutil.copyfileobj(destination_fileobj, fileobj)
+
+
+def split_path(path):
+ parts = path.rsplit("/", 1)
+ if len(parts) == 1:
+ return ("", path)
+ else:
+ return tuple(parts)
+
+
+def join_path(*args):
+ return "/".join(list(filter(None, args)))