Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
zhangyongji
/
MRFramework
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Members
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
cbf5ecc2
authored
Oct 21, 2019
by
Sarkizz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修正解压逻辑
parent
2fc314fe
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
7 deletions
+18
-7
MRFramework/MRFramework/FoundationManagers/Files/MRFiles.swift
+18
-7
No files found.
MRFramework/MRFramework/FoundationManagers/Files/MRFiles.swift
View file @
cbf5ecc2
...
...
@@ -396,14 +396,19 @@ extension MRFiles {
to
directory
:
URL
,
password
:
String
?
=
nil
,
progress
:
((
_
progress
:
Double
)
->
Void
)?
=
nil
,
completion
:
((
_
fileURL
:
URL
?,
_
error
:
Error
?)
->
Void
)?
=
nil
)
{
fileOutput
:
((
_
url
:
URL
)
->
Void
)?
=
nil
,
completion
:
((
_
error
:
Error
?)
->
Void
)?
=
nil
)
{
do
{
try
Zip
.
unzipFile
(
url
,
destination
:
directory
,
overwrite
:
true
,
password
:
password
,
progress
:
progress
,
fileOutputHandler
:
{
url
in
completion
?(
url
,
nil
)
})
try
Zip
.
unzipFile
(
url
,
destination
:
directory
,
overwrite
:
true
,
password
:
password
,
progress
:
progress
,
fileOutputHandler
:
fileOutput
)
completion
?(
nil
)
}
catch
let
err
{
progress
?(
1
)
completion
?(
nil
,
error
(
MRFilesErrorCode
.
unzipError
,
msg
:
"文件解压失败"
))
completion
?(
error
(
MRFilesErrorCode
.
unzipError
,
msg
:
"文件解压失败"
))
#if DEBUG
print
(
"MRFile unzip failed:
\(
err
)\n
"
)
#endif
...
...
@@ -535,9 +540,15 @@ extension URL {
public
func
unzip
(
to
directory
:
URL
?
=
nil
,
password
:
String
?
=
nil
,
progress
:
((
_
progress
:
Double
)
->
Void
)?
=
nil
,
completion
:
((
_
fileURL
:
URL
?,
_
error
:
Error
?)
->
Void
)?
=
nil
)
{
fileOutput
:
((
_
url
:
URL
)
->
Void
)?
=
nil
,
completion
:
((
_
error
:
Error
?)
->
Void
)?
=
nil
)
{
let
destination
=
directory
??
self
.
deletingLastPathComponent
()
MRFiles
.
unzip
(
self
,
to
:
destination
,
password
:
password
,
progress
:
progress
,
completion
:
completion
)
MRFiles
.
unzip
(
self
,
to
:
destination
,
password
:
password
,
progress
:
progress
,
fileOutput
:
fileOutput
,
completion
:
completion
)
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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