From c983fe1c5405c548c52b5f66ccd7c66d1c140f38 Mon Sep 17 00:00:00 2001 From: Dan Federman Date: Wed, 10 Jan 2024 13:23:55 -0700 Subject: [PATCH] Special-case Linux with #if check --- Sources/SafeDITool/SafeDITool.swift | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Sources/SafeDITool/SafeDITool.swift b/Sources/SafeDITool/SafeDITool.swift index f2077787..cb56ea6a 100644 --- a/Sources/SafeDITool/SafeDITool.swift +++ b/Sources/SafeDITool/SafeDITool.swift @@ -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 } } @@ -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 } }