Skip to content

Commit ca3669e

Browse files
Merge pull request #4976 from kkebo/fix-nsdata-write-for-wasi
[wasm] Do not set permissions in `Data.write`
2 parents d7c868a + 301b6f5 commit ca3669e

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Sources/Foundation/NSData.swift

+5
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)