File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
Sources/FoundationEssentials/FileManager Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -905,17 +905,20 @@ extension _FileManagerImpl {
905
905
let group = attributes [ . groupOwnerAccountName] as? String
906
906
let groupID = _readFileAttributePrimitive ( attributes [ . groupOwnerAccountID] , as: UInt . self)
907
907
908
- #if !os(WASI) // WASI does not have the concept of users or groups
909
908
if user != nil || userID != nil || group != nil || groupID != nil {
909
+ #if os(WASI)
910
+ // WASI does not have the concept of users or groups
911
+ throw CocoaError . errorWithFilePath ( . featureUnsupported, path)
912
+ #else
910
913
// Bias toward userID & groupID - try to prevent round trips to getpwnam if possible.
911
914
var leaveUnchanged : UInt32 { UInt32 ( bitPattern: - 1 ) }
912
915
let rawUserID = userID. flatMap ( uid_t. init) ?? user. flatMap ( Self . _userAccountNameToNumber) ?? leaveUnchanged
913
916
let rawGroupID = groupID. flatMap ( gid_t. init) ?? group. flatMap ( Self . _groupAccountNameToNumber) ?? leaveUnchanged
914
917
if chown ( fileSystemRepresentation, rawUserID, rawGroupID) != 0 {
915
918
throw CocoaError . errorWithFilePath ( path, errno: errno, reading: false )
916
919
}
920
+ #endif
917
921
}
918
- #endif
919
922
920
923
try Self . _setCatInfoAttributes ( attributes, path: path)
921
924
You can’t perform that action at this time.
0 commit comments