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
a97fe9b9
Commit
a97fe9b9
authored
Aug 27, 2016
by
Roy Marmelstein
Committed by
GitHub
Aug 27, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #37 from gwjakewelton/swift3.0
Xcode 8 Beta 6 Fixes (Swift 3.0)
parents
376f3efa
233effd7
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
11 deletions
+15
-11
Zip.xcodeproj/project.pbxproj
Zip.xcodeproj/project.pbxproj
+4
-0
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.pbxproj
View file @
a97fe9b9
...
@@ -692,6 +692,7 @@
...
@@ -692,6 +692,7 @@
SUPPORTED_PLATFORMS
=
"appletvsimulator appletvos"
;
SUPPORTED_PLATFORMS
=
"appletvsimulator appletvos"
;
SWIFT_INCLUDE_PATHS
=
"${SRCROOT}/Zip/minizip/**"
;
SWIFT_INCLUDE_PATHS
=
"${SRCROOT}/Zip/minizip/**"
;
SWIFT_OPTIMIZATION_LEVEL
=
"-Onone"
;
SWIFT_OPTIMIZATION_LEVEL
=
"-Onone"
;
SWIFT_VERSION
=
3.0
;
TARGETED_DEVICE_FAMILY
=
3
;
TARGETED_DEVICE_FAMILY
=
3
;
TVOS_DEPLOYMENT_TARGET
=
9.0
;
TVOS_DEPLOYMENT_TARGET
=
9.0
;
};
};
...
@@ -717,6 +718,7 @@
...
@@ -717,6 +718,7 @@
SUPPORTED_PLATFORMS
=
"appletvsimulator appletvos"
;
SUPPORTED_PLATFORMS
=
"appletvsimulator appletvos"
;
SWIFT_INCLUDE_PATHS
=
"${SRCROOT}/Zip/minizip/**"
;
SWIFT_INCLUDE_PATHS
=
"${SRCROOT}/Zip/minizip/**"
;
SWIFT_OPTIMIZATION_LEVEL
=
"-Owholemodule"
;
SWIFT_OPTIMIZATION_LEVEL
=
"-Owholemodule"
;
SWIFT_VERSION
=
3.0
;
TARGETED_DEVICE_FAMILY
=
3
;
TARGETED_DEVICE_FAMILY
=
3
;
TVOS_DEPLOYMENT_TARGET
=
9.0
;
TVOS_DEPLOYMENT_TARGET
=
9.0
;
};
};
...
@@ -742,6 +744,7 @@
...
@@ -742,6 +744,7 @@
SDKROOT
=
macosx
;
SDKROOT
=
macosx
;
SKIP_INSTALL
=
YES
;
SKIP_INSTALL
=
YES
;
SWIFT_INCLUDE_PATHS
=
"${SRCROOT}/Zip/minizip/**"
;
SWIFT_INCLUDE_PATHS
=
"${SRCROOT}/Zip/minizip/**"
;
SWIFT_VERSION
=
3.0
;
};
};
name
=
Debug
;
name
=
Debug
;
};
};
...
@@ -766,6 +769,7 @@
...
@@ -766,6 +769,7 @@
SKIP_INSTALL
=
YES
;
SKIP_INSTALL
=
YES
;
SWIFT_INCLUDE_PATHS
=
"${SRCROOT}/Zip/minizip/**"
;
SWIFT_INCLUDE_PATHS
=
"${SRCROOT}/Zip/minizip/**"
;
SWIFT_OPTIMIZATION_LEVEL
=
"-Owholemodule"
;
SWIFT_OPTIMIZATION_LEVEL
=
"-Owholemodule"
;
SWIFT_VERSION
=
3.0
;
};
};
name
=
Release
;
name
=
Release
;
};
};
...
...
Zip.xcodeproj/project.xcworkspace/xcshareddata/Zip.xcscmblueprint
View file @
a97fe9b9
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
"DVTSourceControlWorkspaceBlueprintIdentifierKey" : "F3707899-72AE-49DA-9BDD-5CB0B64CF03A",
"DVTSourceControlWorkspaceBlueprintIdentifierKey" : "F3707899-72AE-49DA-9BDD-5CB0B64CF03A",
"DVTSourceControlWorkspaceBlueprintWorkingCopyPathsKey" : {
"DVTSourceControlWorkspaceBlueprintWorkingCopyPathsKey" : {
"8DA5B175D3FDB92A3B3CCBD4109A734F1316A3DD" : "Zip\/Zip\/minizip\/",
"8DA5B175D3FDB92A3B3CCBD4109A734F1316A3DD" : "Zip\/Zip\/minizip\/",
"3DD768C8AB2D6A2647C9EF99992D3CC5820E77C4" : "Zip
-swift3
\/"
"3DD768C8AB2D6A2647C9EF99992D3CC5820E77C4" : "Zip\/"
},
},
"DVTSourceControlWorkspaceBlueprintNameKey" : "Zip",
"DVTSourceControlWorkspaceBlueprintNameKey" : "Zip",
"DVTSourceControlWorkspaceBlueprintVersion" : 204,
"DVTSourceControlWorkspaceBlueprintVersion" : 204,
...
...
Zip/QuickZip.swift
View file @
a97fe9b9
...
@@ -37,7 +37,7 @@ extension Zip {
...
@@ -37,7 +37,7 @@ extension Zip {
- returns: NSURL of the destination folder.
- 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
fileManager
=
FileManager
.
default
let
fileExtension
=
path
.
pathExtension
let
fileExtension
=
path
.
pathExtension
...
@@ -85,10 +85,10 @@ extension Zip {
...
@@ -85,10 +85,10 @@ extension Zip {
- returns: NSURL of the destination folder.
- 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
fileManager
=
FileManager
.
default
let
documentsUrl
=
fileManager
.
urls
(
for
:
.
documentDirectory
,
in
:
.
userDomainMask
)[
0
]
as
URL
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
)
try
self
.
zipFiles
(
paths
,
zipFilePath
:
destinationUrl
,
password
:
nil
,
progress
:
progress
)
return
destinationUrl
return
destinationUrl
}
}
...
...
Zip/Zip.swift
View file @
a97fe9b9
...
@@ -62,7 +62,7 @@ public class Zip {
...
@@ -62,7 +62,7 @@ public class Zip {
- notes: Supports implicit progress composition
- 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
// File manager
let
fileManager
=
FileManager
.
default
let
fileManager
=
FileManager
.
default
...
@@ -112,7 +112,7 @@ public class Zip {
...
@@ -112,7 +112,7 @@ public class Zip {
throw
ZipError
.
unzipFail
throw
ZipError
.
unzipFail
}
}
var
fileInfo
=
unz_file_info64
()
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
)
ret
=
unzGetCurrentFileInfo64
(
zip
,
&
fileInfo
,
nil
,
0
,
nil
,
0
,
nil
,
0
)
if
ret
!=
UNZ_OK
{
if
ret
!=
UNZ_OK
{
unzCloseCurrentFile
(
zip
)
unzCloseCurrentFile
(
zip
)
...
@@ -179,7 +179,7 @@ public class Zip {
...
@@ -179,7 +179,7 @@ public class Zip {
// Update progress handler
// Update progress handler
if
let
progressHandler
=
progress
{
if
let
progressHandler
=
progress
{
progressHandler
(
progress
:
(
currentPosition
/
totalSize
))
progressHandler
((
currentPosition
/
totalSize
))
}
}
progressTracker
.
completedUnitCount
=
Int64
(
currentPosition
)
progressTracker
.
completedUnitCount
=
Int64
(
currentPosition
)
...
@@ -188,7 +188,7 @@ public class Zip {
...
@@ -188,7 +188,7 @@ public class Zip {
// Completed. Update progress handler.
// Completed. Update progress handler.
if
let
progressHandler
=
progress
{
if
let
progressHandler
=
progress
{
progressHandler
(
progress
:
1.0
)
progressHandler
(
1.0
)
}
}
progressTracker
.
completedUnitCount
=
Int64
(
totalSize
)
progressTracker
.
completedUnitCount
=
Int64
(
totalSize
)
...
@@ -209,7 +209,7 @@ public class Zip {
...
@@ -209,7 +209,7 @@ public class Zip {
- notes: Supports implicit progress composition
- 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
// File manager
let
fileManager
=
FileManager
.
default
let
fileManager
=
FileManager
.
default
...
@@ -291,7 +291,7 @@ public class Zip {
...
@@ -291,7 +291,7 @@ public class Zip {
// Update progress handler
// Update progress handler
if
let
progressHandler
=
progress
{
if
let
progressHandler
=
progress
{
progressHandler
(
progress
:
(
currentPosition
/
totalSize
))
progressHandler
((
currentPosition
/
totalSize
))
}
}
progressTracker
.
completedUnitCount
=
Int64
(
currentPosition
)
progressTracker
.
completedUnitCount
=
Int64
(
currentPosition
)
...
@@ -305,7 +305,7 @@ public class Zip {
...
@@ -305,7 +305,7 @@ public class Zip {
// Completed. Update progress handler.
// Completed. Update progress handler.
if
let
progressHandler
=
progress
{
if
let
progressHandler
=
progress
{
progressHandler
(
progress
:
1.0
)
progressHandler
(
1.0
)
}
}
progressTracker
.
completedUnitCount
=
Int64
(
totalSize
)
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