Skip to content

Commit 301b6f5

Browse files
committed
[wasm] Do not set permissions in Data.write
This fixes swiftwasm/swift#5584.
1 parent d7c868a commit 301b6f5

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Sources/Foundation/NSData.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,12 @@ open class NSData : NSObject, NSCopying, NSMutableCopying, NSSecureCoding {
457457
}
458458

459459
let fm = FileManager.default
460+
#if os(WASI)
461+
// WASI does not have permission concept
462+
let permissions: Int? = nil
463+
#else
460464
let permissions = try? fm._permissionsOfItem(atPath: path)
465+
#endif
461466

462467
if writeOptionsMask.contains(.atomic) {
463468
let (newFD, auxFilePath) = try _NSCreateTemporaryFile(path)

0 commit comments

Comments
 (0)