Skip to content

Commit

Permalink
Fix Linux build
Browse files Browse the repository at this point in the history
  • Loading branch information
weichsel committed Jun 9, 2024
1 parent 8a0e219 commit f4d22b8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Sources/ZIPFoundation/Archive+MemoryFile.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ extension Archive {
: funopen(cookie.toOpaque(), readStub, nil, seekStub, closeStub)!
#else
let stubs = cookie_io_functions_t(read: readStub, write: writeStub, seek: seekStub, close: closeStub)
let result = fopencookie(cookie.toOpaque(), mode, stubs)!
let result = fopencookie(cookie.toOpaque(), mode.posixMode, stubs)!
#endif
return result
}
Expand Down
8 changes: 8 additions & 0 deletions Sources/ZIPFoundation/Archive.swift
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,14 @@ public final class Archive: Sequence {
case update

var isWritable: Bool { self != .read }

var posixMode: String {
switch self {
case .read: return "rb"
case .create: return "wb+"
case .update: return "rb+"
}
}
}

/// The version of an `Archive`
Expand Down

0 comments on commit f4d22b8

Please sign in to comment.