diff --git a/Sources/FoundationEssentials/Data/Data+Writing.swift b/Sources/FoundationEssentials/Data/Data+Writing.swift index 4f92cb1a6..44cf53d64 100644 --- a/Sources/FoundationEssentials/Data/Data+Writing.swift +++ b/Sources/FoundationEssentials/Data/Data+Writing.swift @@ -127,6 +127,10 @@ private func cleanupTemporaryDirectory(at inPath: String?) { /// Caller is responsible for calling `close` on the `Int32` file descriptor. private func createTemporaryFile(at destinationPath: String, inPath: PathOrURL, prefix: String, options: Data.WritingOptions) throws -> (Int32, String) { +#if os(WASI) + // WASI does not have temp directories + throw CocoaError(.featureUnsupported) +#else var directoryPath = destinationPath if !directoryPath.isEmpty && directoryPath.last! != "/" { directoryPath.append("/") @@ -181,6 +185,7 @@ private func createTemporaryFile(at destinationPath: String, inPath: PathOrURL, } } } while true +#endif // os(WASI) } /// Returns `(file descriptor, temporary file path, temporary directory path)`