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
5f6f7e90
Commit
5f6f7e90
authored
Apr 27, 2015
by
Fabian-Andree Heidemann
Browse files
Use handle_file_name_collision in decompress
parent
d0e64380
Changes
1
Hide whitespace changes
Inline
Side-by-side
vispa/remote/filesystem.py
View file @
5f6f7e90
...
...
@@ -358,19 +358,11 @@ class FileSystem(object):
def
decompress
(
self
,
file
):
# filepath and extract path
filepath
=
self
.
expand
(
file
)
path
=
filepath
.
rsplit
(
".zip"
,
1
)[
0
]
# handle folder collision for extract path
while
os
.
path
.
exists
(
path
):
end
=
path
.
rsplit
(
"/"
,
1
)[
1
]
if
len
(
end
.
split
(
"_copy"
))
is
not
1
:
counter
=
int
(
end
.
rsplit
(
"_copy"
,
1
)[
1
])
counter
+=
1
path
=
path
.
rsplit
(
"_copy"
,
1
)[
0
]
+
"_copy"
+
str
(
counter
)
else
:
path
=
path
+
"_copy1"
path
=
filepath
.
rsplit
(
"/"
,
1
)[
0
]
foldername
=
(
filepath
.
rsplit
(
"/"
,
1
)[
1
]).
rsplit
(
".zip"
,
1
)[
0
]
with
ZipFile
(
filepath
,
"r"
)
as
archive
:
archive
.
extractall
(
path
)
archive
.
extractall
(
path
+
"/"
+
self
.
handle_file_name_collision
(
foldername
,
path
)
)
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