createSymbolicLink(named:in:attributes:linkContents:context:replyHandler:)
Creates a new symbolic link.
Declaration
func createSymbolicLink(named name: FSFileName, in directory: FSItem, attributes newAttributes: FSItem.SetAttributesRequest, linkContents contents: FSFileName, context: FSContext, replyHandler reply: @escaping @Sendable (FSCreateSymlinkResult?, (any Error)?) -> Void)func createSymbolicLink(named name: FSFileName, in directory: FSItem, attributes newAttributes: FSItem.SetAttributesRequest, linkContents contents: FSFileName, context: FSContext) async throws -> FSCreateSymlinkResultParameters
- name:
The new item’s name.
- directory:
The directory in which to create the item.
- newAttributes:
Attributes to apply to the new item.
- contents:
The contents of the new symbolic link.
- context:
An object that enables context-aware file system decisions throughout the operation.
- reply:
A block or closure to indicate success or failure. If creation succeeds, pass an instance of Fscreatesymlinkresult containing the newly-created Fsitem, its Fsfilename, its Attributes, the updated Attributes of the parent directory, and the volume’s updated free space, along with a
nilerror. If creation fails, pass the relevant error as the second parameter; FSKit ignores the Fscreatesymlinkresult instance in this case. For anasyncSwift implementation, there’s no reply handler; simply return the result instance or throw an error.
Discussion
If an item named name already exists in the directory indicated by directory, complete the request with an error with a domain of NSPOSIXErrorDomain and a code of EEXIST.