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
7491daac
Commit
7491daac
authored
Jan 27, 2016
by
Roy Marmelstein
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Easier/safer access to filePath in processed file struct
parent
065b28c2
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
9 deletions
+15
-9
Zip/Zip.swift
Zip/Zip.swift
+6
-9
Zip/ZipUtilities.swift
Zip/ZipUtilities.swift
+9
-0
No files found.
Zip/Zip.swift
View file @
7491daac
...
...
@@ -207,23 +207,20 @@ public class Zip {
// Get totalSize for progress handler
for
path
in
processedPaths
{
do
{
if
let
filePath
=
path
.
filePathURL
.
path
{
let
filePath
=
path
.
filePath
()
let
fileAttributes
=
try
fileManager
.
attributesOfItemAtPath
(
filePath
)
let
fileSize
=
fileAttributes
[
NSFileSize
]
as?
Double
if
let
fileSize
=
fileSize
{
totalSize
+=
fileSize
}
}
}
catch
{}
}
// Begin Zipping
let
zip
=
zipOpen
(
destinationPath
,
APPEND_STATUS_CREATE
)
for
path
in
processedPaths
{
guard
let
filePath
=
path
.
filePathURL
.
path
else
{
throw
ZipError
.
ZipFail
}
let
filePath
=
path
.
filePath
()
var
isDirectory
:
ObjCBool
=
false
fileManager
.
fileExistsAtPath
(
filePath
,
isDirectory
:
&
isDirectory
)
if
!
isDirectory
{
...
...
Zip/ZipUtilities.swift
View file @
7491daac
...
...
@@ -19,6 +19,15 @@ internal class ZipUtilities {
internal
struct
ProcessedFilePath
{
let
filePathURL
:
NSURL
let
fileName
:
String
?
func
filePath
()
->
String
{
if
let
filePath
=
filePathURL
.
path
{
return
filePath
}
else
{
return
String
()
}
}
}
//MARK: Path processing
...
...
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