Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Z
Zip
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Jira
Jira
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
YongYue
Zip
Commits
26b48168
Commit
26b48168
authored
Aug 17, 2016
by
Jake
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix compiler errors for beta 6
parent
db76c1bf
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
11 deletions
+11
-11
Zip.xcodeproj/project.xcworkspace/xcshareddata/Zip.xcscmblueprint
...eproj/project.xcworkspace/xcshareddata/Zip.xcscmblueprint
+1
-1
Zip/QuickZip.swift
Zip/QuickZip.swift
+3
-3
Zip/Zip.swift
Zip/Zip.swift
+7
-7
No files found.
Zip.xcodeproj/project.xcworkspace/xcshareddata/Zip.xcscmblueprint
View file @
26b48168
...
...
@@ -10,7 +10,7 @@
"DVTSourceControlWorkspaceBlueprintIdentifierKey" : "F3707899-72AE-49DA-9BDD-5CB0B64CF03A",
"DVTSourceControlWorkspaceBlueprintWorkingCopyPathsKey" : {
"8DA5B175D3FDB92A3B3CCBD4109A734F1316A3DD" : "Zip\/Zip\/minizip\/",
"3DD768C8AB2D6A2647C9EF99992D3CC5820E77C4" : "Zip
-swift3
\/"
"3DD768C8AB2D6A2647C9EF99992D3CC5820E77C4" : "Zip\/"
},
"DVTSourceControlWorkspaceBlueprintNameKey" : "Zip",
"DVTSourceControlWorkspaceBlueprintVersion" : 204,
...
...
Zip/QuickZip.swift
View file @
26b48168
...
...
@@ -37,7 +37,7 @@ extension Zip {
- returns: NSURL of the destination folder.
*/
public
class
func
quickUnzipFile
(
_
path
:
URL
,
progress
:
((
progress
:
Double
)
->
())?)
throws
->
URL
{
public
class
func
quickUnzipFile
(
_
path
:
URL
,
progress
:
((
_
progress
:
Double
)
->
())?)
throws
->
URL
{
let
fileManager
=
FileManager
.
default
let
fileExtension
=
path
.
pathExtension
...
...
@@ -85,10 +85,10 @@ extension Zip {
- returns: NSURL of the destination folder.
*/
public
class
func
quickZipFiles
(
_
paths
:
[
URL
],
fileName
:
String
,
progress
:
((
progress
:
Double
)
->
())?)
throws
->
URL
{
public
class
func
quickZipFiles
(
_
paths
:
[
URL
],
fileName
:
String
,
progress
:
((
_
progress
:
Double
)
->
())?)
throws
->
URL
{
let
fileManager
=
FileManager
.
default
let
documentsUrl
=
fileManager
.
urls
(
for
:
.
documentDirectory
,
in
:
.
userDomainMask
)[
0
]
as
URL
let
destinationUrl
=
try!
documentsUrl
.
appendingPathComponent
(
"
\(
fileName
)
.zip"
)
let
destinationUrl
=
documentsUrl
.
appendingPathComponent
(
"
\(
fileName
)
.zip"
)
try
self
.
zipFiles
(
paths
,
zipFilePath
:
destinationUrl
,
password
:
nil
,
progress
:
progress
)
return
destinationUrl
}
...
...
Zip/Zip.swift
View file @
26b48168
...
...
@@ -62,7 +62,7 @@ public class Zip {
- notes: Supports implicit progress composition
*/
public
class
func
unzipFile
(
_
zipFilePath
:
URL
,
destination
:
URL
,
overwrite
:
Bool
,
password
:
String
?,
progress
:
((
progress
:
Double
)
->
())?)
throws
{
public
class
func
unzipFile
(
_
zipFilePath
:
URL
,
destination
:
URL
,
overwrite
:
Bool
,
password
:
String
?,
progress
:
((
_
progress
:
Double
)
->
())?)
throws
{
// File manager
let
fileManager
=
FileManager
.
default
...
...
@@ -112,7 +112,7 @@ public class Zip {
throw
ZipError
.
unzipFail
}
var
fileInfo
=
unz_file_info64
()
memset
(
&
fileInfo
,
0
,
sizeof
(
unz_file_info
.
self
)
)
memset
(
&
fileInfo
,
0
,
MemoryLayout
<
unz_file_info
>.
size
)
ret
=
unzGetCurrentFileInfo64
(
zip
,
&
fileInfo
,
nil
,
0
,
nil
,
0
,
nil
,
0
)
if
ret
!=
UNZ_OK
{
unzCloseCurrentFile
(
zip
)
...
...
@@ -179,7 +179,7 @@ public class Zip {
// Update progress handler
if
let
progressHandler
=
progress
{
progressHandler
(
progress
:
(
currentPosition
/
totalSize
))
progressHandler
((
currentPosition
/
totalSize
))
}
progressTracker
.
completedUnitCount
=
Int64
(
currentPosition
)
...
...
@@ -188,7 +188,7 @@ public class Zip {
// Completed. Update progress handler.
if
let
progressHandler
=
progress
{
progressHandler
(
progress
:
1.0
)
progressHandler
(
1.0
)
}
progressTracker
.
completedUnitCount
=
Int64
(
totalSize
)
...
...
@@ -209,7 +209,7 @@ public class Zip {
- notes: Supports implicit progress composition
*/
public
class
func
zipFiles
(
_
paths
:
[
URL
],
zipFilePath
:
URL
,
password
:
String
?,
progress
:
((
progress
:
Double
)
->
())?)
throws
{
public
class
func
zipFiles
(
_
paths
:
[
URL
],
zipFilePath
:
URL
,
password
:
String
?,
progress
:
((
_
progress
:
Double
)
->
())?)
throws
{
// File manager
let
fileManager
=
FileManager
.
default
...
...
@@ -291,7 +291,7 @@ public class Zip {
// Update progress handler
if
let
progressHandler
=
progress
{
progressHandler
(
progress
:
(
currentPosition
/
totalSize
))
progressHandler
((
currentPosition
/
totalSize
))
}
progressTracker
.
completedUnitCount
=
Int64
(
currentPosition
)
...
...
@@ -305,7 +305,7 @@ public class Zip {
// Completed. Update progress handler.
if
let
progressHandler
=
progress
{
progressHandler
(
progress
:
1.0
)
progressHandler
(
1.0
)
}
progressTracker
.
completedUnitCount
=
Int64
(
totalSize
)
...
...
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