Closed kkebo closed 3 weeks ago
Good catch! Don't we need to fix _setAttributes
too?
@kateinoigakukun
Don't we need to fix _setAttributes too?
I'm sorry, but I don't understand what you mean by "fix _setAttributes
".
I changed permissions
so that the condition of the if
statement are always not satisfied instead of enclosing the following lines with #if !os(WASI)
.
(If you have a better solution, I'm ok to close this PR.)
@kkebo Sorry, I meant it might be better to ignore the permission attribute within FileManager.setAttributes
. Currently all users of the API also need to exclude FileAttributeKey.posixPermissions
entry from the passing attributes manually as we do in this PR but it's just annoying for most of the use cases...
@kateinoigakukun Thank you. That makes sense and it can solve many problems with less code. On the other hand, since it is true that the posixPermissions
key is not supported on WASI, I feel that we should throw an error and notify programmers, and also programmers should not try to set posixPermissions
in the first place.
Okay, given that the API is not so widely used directly, asking users to change their code might be practically reasonable 👍
@swift-ci test
We're going to lose this diff once we delete this file in the package branch. Please open a corresponding patch for https://github.com/apple/swift-foundation.
Actually, this one may persist because this change was only made to the class type NSData
and not the struct - was that intentional?
@parkera
Actually, this one may persist because this change was only made to the class type NSData and not the struct - was that intentional?
At least in swift-corelibs-foundation, the Data.write
method calls the NSData.write
method and does not have its own implementation.
This will soon no longer be the case - see here: https://github.com/apple/swift-foundation/blob/main/Sources/FoundationEssentials/Data/Data%2BWriting.swift
Yes, I know swift-foundation's Data.write
.
Besides, I have read your comment before, and I know we will eventually use the implementation of swift-foundation instead of this repository, but I don't know how much effort we need to make swift-foundation compatible with Wasm.
This fixes https://github.com/swiftwasm/swift/issues/5584.
This PR does not affect platforms other than WASI.