Skip to content

Commit

Permalink
Try replacing colons in Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
fpseverino committed Sep 9, 2024
1 parent bd66eed commit 43d1a60
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions Sources/Zip/Zip.swift
Original file line number Diff line number Diff line change
Expand Up @@ -144,15 +144,13 @@ public class Zip {
}

var writeBytes: UInt64 = 0
#if os(Windows)
let filePointer: UnsafeMutablePointer<FILE>? = fopen(fullPath.replacingOccurrences(of: ":", with: "%3A"), "wb")
#else
let filePointer: UnsafeMutablePointer<FILE>? = fopen(fullPath, "wb")
if filePointer == nil {
print("XXXXXXXX - filePointer is nil")
}
#endif
while let filePointer {
let readBytes = unzReadCurrentFile(zip, &buffer, bufferSize)
if readBytes < 0 {
print("XXXXXXXXXXXX - Failed to read from \(fullPath), error code: \(readBytes)")
}
guard readBytes > 0 else { break }
guard fwrite(buffer, Int(readBytes), 1, filePointer) == 1 else {
throw ZipError.unzipFail
Expand All @@ -164,9 +162,6 @@ public class Zip {
if unzCloseCurrentFile(zip) == UNZ_CRCERROR {
throw ZipError.unzipFail
}
print("File: \(fullPath)")
print("writeBytes: \(writeBytes)")
print("fileInfo.uncompressed_size: \(fileInfo.uncompressed_size)")
guard writeBytes == fileInfo.uncompressed_size else {
// WINDOWS FAILS HERE
print("XXXXXXXXXXXXXXXXXXXXXXXX - 8")
Expand Down

0 comments on commit 43d1a60

Please sign in to comment.