swiftwasm/swift

Atomic file writing

kkebo opened this issue · 1 comments

kkebo commented

derived from #5593

Description

Currently, SwiftWasm doesn't support the following code for wasm32-unknown-wasi:

import Foundation
Data().write(to: URL(filePath: "hoge"), options: .atomic)

It's because the option .atomic requires creating a temporary file, and swift-foundation doesn't support it if os(WASI).

Ideas

One idea: #5593 (comment)

How about allowing atomic file writing when TMPDIR environment variable is explicitly defined?