Skip to content

Commit

Permalink
Try fixing zipping
Browse files Browse the repository at this point in the history
  • Loading branch information
fpseverino committed Sep 29, 2024
1 parent 1729655 commit d91b56f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Sources/Zip/ArchiveFile.swift
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ extension Zip {
progressTracker.kind = ProgressKind.file

// Begin Zipping
let zip = zipOpen(zipFilePath.path, APPEND_STATUS_CREATE)
let zip = zipOpen(zipFilePath.withUnsafeFileSystemRepresentation { String(cString: $0!) }, APPEND_STATUS_CREATE)

for archiveFile in archiveFiles {
// Skip empty data
Expand Down
2 changes: 1 addition & 1 deletion Sources/Zip/Zip.swift
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ public class Zip {
progressTracker.kind = ProgressKind.file

// Begin Zipping
let zip = zipOpen(zipFilePath.path, APPEND_STATUS_CREATE)
let zip = zipOpen(zipFilePath.withUnsafeFileSystemRepresentation { String(cString: $0!) }, APPEND_STATUS_CREATE)
for path in processedPaths {
let filePath = path.filePath
var isDirectory: ObjCBool = false
Expand Down
8 changes: 4 additions & 4 deletions Sources/Zip/ZipUtilities.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ internal class ZipUtilities {
let fileName: String?

var filePath: String {
filePathURL.path
filePathURL.withUnsafeFileSystemRepresentation { String(cString: $0!) }
}
}

Expand All @@ -59,7 +59,7 @@ internal class ZipUtilities {
var processedFilePaths = [ProcessedFilePath]()
for pathURL in paths {
var isDirectory: ObjCBool = false
_ = FileManager.default.fileExists(atPath: pathURL.path, isDirectory: &isDirectory)
_ = FileManager.default.fileExists(atPath: pathURL.withUnsafeFileSystemRepresentation { String(cString: $0!) }, isDirectory: &isDirectory)
if !isDirectory.boolValue {
let processedPath = ProcessedFilePath(filePathURL: pathURL, fileName: pathURL.lastPathComponent)
processedFilePaths.append(processedPath)
Expand All @@ -80,11 +80,11 @@ internal class ZipUtilities {
*/
internal func expandDirectoryFilePath(_ directory: URL) -> [ProcessedFilePath] {
var processedFilePaths = [ProcessedFilePath]()
if let enumerator = FileManager.default.enumerator(atPath: directory.path) {
if let enumerator = FileManager.default.enumerator(atPath: directory.withUnsafeFileSystemRepresentation { String(cString: $0!) }) {
while let filePathComponent = enumerator.nextObject() as? String {
let pathURL = directory.appendingPathComponent(filePathComponent)
var isDirectory: ObjCBool = false
_ = FileManager.default.fileExists(atPath: pathURL.path, isDirectory: &isDirectory)
_ = FileManager.default.fileExists(atPath: pathURL.withUnsafeFileSystemRepresentation { String(cString: $0!) }, isDirectory: &isDirectory)
if !isDirectory.boolValue {
var fileName = filePathComponent
if includeRootDirectory {
Expand Down

0 comments on commit d91b56f

Please sign in to comment.