diff --git a/Sources/Zip/ArchiveFile.swift b/Sources/Zip/ArchiveFile.swift index c7216a13..f1fef477 100644 --- a/Sources/Zip/ArchiveFile.swift +++ b/Sources/Zip/ArchiveFile.swift @@ -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 diff --git a/Sources/Zip/Zip.swift b/Sources/Zip/Zip.swift index caf3ea70..5f99996b 100644 --- a/Sources/Zip/Zip.swift +++ b/Sources/Zip/Zip.swift @@ -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 diff --git a/Sources/Zip/ZipUtilities.swift b/Sources/Zip/ZipUtilities.swift index 599cf895..bb045fcb 100644 --- a/Sources/Zip/ZipUtilities.swift +++ b/Sources/Zip/ZipUtilities.swift @@ -42,7 +42,7 @@ internal class ZipUtilities { let fileName: String? var filePath: String { - filePathURL.path + filePathURL.withUnsafeFileSystemRepresentation { String(cString: $0!) } } } @@ -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) @@ -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 {