Skip to content

Commit 22500b8

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 f77911a commit 22500b8

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
@@ -276,6 +276,9 @@ extension _FileManagerImpl {
276276
}
277277
attr?[.protectionKey] = nil
278278
}
279+
#elseif os(WASI)
280+
// WASI doesn't support a temporary file, so can't use `.atomic`
281+
let opts: Data.WritingOptions = []
279282
#else
280283
let opts = Data.WritingOptions.atomic
281284
#endif

0 commit comments

Comments
 (0)