lookupItem(named:in:context:replyHandler:)
Looks up an item within a directory.
Declaration
func lookupItem(named name: FSFileName, in directory: FSItem, context: FSContext, replyHandler reply: @escaping @Sendable (FSLookupItemResult?, (any Error)?) -> Void)func lookupItem(named name: FSFileName, in directory: FSItem, context: FSContext) async throws -> FSLookupItemResultParameters
- name:
The name of the item to look up.
- directory:
The directory in which to look up the item.
- context:
An object that enables context-aware file system decisions throughout the operation.
- reply:
A block or closure to indicate success or failure. If lookup succeeds, pass an instance of Fslookupitemresult containing the found Fsitem, its Fsfilename (as saved within the file system), and its Attributes, along with a
nilerror. If lookup fails, pass the relevant error as the second parameter; FSKit ignores the Fslookupitemresult instance in this case. For anasyncSwift implementation, there’s no reply handler; simply return the result instance or throw an error.
Discussion
If no item matching name exists in the directory indicated by directory, complete the request with an error with a domain of NSPOSIXErrorDomain and a code of ENOENT.
See Also
Working with items
createItem(named:type:in:attributes:context:replyHandler:)FSFileNameFSItem.ItemTypeFSItem.SetAttributesRequestFSCreateItemResultFSLookupItemResultremoveItem(_:named:from:context:replyHandler:)FSRemoveItemResultrenameItem(_:inDirectory:named:to:inDirectory:overItem:context:replyHandler:)FSRenameItemResultreclaimItem(_:replyHandler:)