Skip to content

Commit 8934b4c

Browse files
committed
Use 'if #unavailable' instead of 'if #available' to avoid falling into '*' when building for Linux
1 parent 826b677 commit 8934b4c

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Sources/SafeDITool/SafeDITool.swift

+6-6
Original file line numberDiff line numberDiff line change
@@ -238,10 +238,10 @@ struct SafeDITool: AsyncParsableCommand {
238238

239239
extension Data {
240240
fileprivate func write(toPath filePath: String) throws {
241-
if #available(macOS 13.0, iOS 16.0, tvOS 16.0, watchOS 9.0, *) {
242-
try write(to: URL(filePath: filePath))
243-
} else {
241+
if #unavailable(macOS 13.0, iOS 16.0, tvOS 16.0, watchOS 9.0) {
244242
try write(to: URL(fileURLWithPath: filePath))
243+
} else {
244+
try write(to: URL(filePath: filePath))
245245
}
246246
}
247247
}
@@ -252,10 +252,10 @@ extension String {
252252
}
253253

254254
fileprivate var asFileURL: URL {
255-
if #available(macOS 13.0, iOS 16.0, tvOS 16.0, watchOS 9.0, *) {
256-
URL(filePath: self)
257-
} else {
255+
if #unavailable(macOS 13.0, iOS 16.0, tvOS 16.0, watchOS 9.0) {
258256
URL(fileURLWithPath: self)
257+
} else {
258+
URL(filePath: self)
259259
}
260260
}
261261
}

0 commit comments

Comments
 (0)