Skip to content

Commit 97b147b

Browse files
committed
[wasm] Make FileManager.createFile() work on WASI
fixes swiftwasm/swift#5593 `FileManager.createFile()` currently doesn't work on WASI because it requires `.atomic`, it requires creating a temporary file, and it isn't suppported on WASI. So I have fixed that by removing the `.atomic` requirement only on WASI.
1 parent e9d59b6 commit 97b147b

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Sources/FoundationEssentials/FileManager/FileManager+Files.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,9 @@ extension _FileManagerImpl {
260260
}
261261
attr?[.protectionKey] = nil
262262
}
263+
#elseif os(WASI)
264+
// WASI doesn't support a temporary file, so can't use `.atomic`
265+
let opts: Data.WritingOptions = []
263266
#else
264267
let opts = Data.WritingOptions.atomic
265268
#endif

0 commit comments

Comments
 (0)