Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
3pia
VISPA
VISPA web
Commits
fff37f02
Commit
fff37f02
authored
Apr 28, 2015
by
Marcel Rieger
Browse files
Use python methods in decompress.
parent
5f6f7e90
Changes
1
Hide whitespace changes
Inline
Side-by-side
vispa/remote/filesystem.py
View file @
fff37f02
...
...
@@ -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
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment