Commit fff37f02 authored by Marcel Rieger's avatar Marcel Rieger
Browse files

Use python methods in decompress.

parent 5f6f7e90
......@@ -355,14 +355,16 @@ class FileSystem(object):
logger.debug(p)
archive.write(p, ap)
def decompress(self, file):
def decompress(self, path):
# filepath and extract path
filepath = self.expand(file)
path = filepath.rsplit("/", 1)[0]
foldername = (filepath.rsplit("/", 1)[1]).rsplit(".zip", 1)[0]
path = self.expand(path)
# "foo/bar/file.zip" -> ("foo/bar", "file")
dst = os.path.split(os.path.splitext(path)[0])
with ZipFile(filepath, "r") as archive:
archive.extractall(path + "/" + self.handle_file_name_collision(foldername, path))
with ZipFile(path, "r") as archive:
dstdir = os.path.join(dst[0], self.handle_file_name_collision(dst[1], dst[0]))
archive.extractall(dstdir)
def paste(self, path, fullsrc, cut):
# TODO
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment