Contents

checkAccess(to:requestedAccess:context:replyHandler:)

Checks whether the file system allows access to the given item.

Declaration

func checkAccess(to theItem: FSItem, requestedAccess access: FSVolume.AccessMask, context: FSContext, replyHandler reply: @escaping  @Sendable (FSCheckAccessResult?, (any Error)?) -> Void)
func checkAccess(to theItem: FSItem, requestedAccess access: FSVolume.AccessMask, context: FSContext) async throws -> FSCheckAccessResult

Parameters

  • theItem:

    The item for which to check access.

  • access:

    A mask indicating a set of access types for which to check.

  • context:

    An object that enables context-aware file system decisions throughout the operation.

  • reply:

    A block or closure to indicate success or failure. If the access check succeeds, pass an instance of Fscheckaccessresult containing a Boolean value to indicate whether the file system grants access, along with a nil error. If the access check fails, pass the relevant error as the second parameter; FSKit ignores the Fscheckaccessresult instance in this case. For an async Swift implementation, there’s no reply handler; simply return the result instance or throw an error.

See Also

Checking access