Skip to content

Commit

Permalink
[wasm] Make FileManager.createFile() work on WASI
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
kkebo committed Oct 19, 2024
1 parent f77911a commit 22500b8
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,9 @@ extension _FileManagerImpl {
}
attr?[.protectionKey] = nil
}
#elseif os(WASI)
// WASI doesn't support a temporary file, so can't use `.atomic`
let opts: Data.WritingOptions = []
#else
let opts = Data.WritingOptions.atomic
#endif
Expand Down

0 comments on commit 22500b8

Please sign in to comment.