Skip to content

Commit

Permalink
Special-case Linux with #if check
Browse files Browse the repository at this point in the history
  • Loading branch information
dfed committed Jan 10, 2024
1 parent a28b5e8 commit c983fe1
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Sources/SafeDITool/SafeDITool.swift
Original file line number Diff line number Diff line change
Expand Up @@ -238,11 +238,15 @@ struct SafeDITool: AsyncParsableCommand {

extension Data {
fileprivate func write(toPath filePath: String) throws {
#if os(Linux)
try write(to: URL(fileURLWithPath: filePath))
#else
if #available(macOS 13.0, iOS 16.0, tvOS 16.0, watchOS 9.0, *) {
try write(to: URL(filePath: filePath))
} else {
try write(to: URL(fileURLWithPath: filePath))
}
#endif
}
}

Expand All @@ -252,10 +256,14 @@ extension String {
}

fileprivate var asFileURL: URL {
#if os(Linux)
URL(fileURLWithPath: self)
#else
if #available(macOS 13.0, iOS 16.0, tvOS 16.0, watchOS 9.0, *) {
URL(filePath: self)
} else {
URL(fileURLWithPath: self)
}
#endif
}
}

0 comments on commit c983fe1

Please sign in to comment.