createSymbolicLink(named:inDirectory:attributes:linkContents:replyHandler:)
Creates a new symbolic link.
Declaration
func createSymbolicLink(named name: FSFileName, inDirectory directory: FSItem, attributes newAttributes: FSItem.SetAttributesRequest, linkContents contents: FSFileName, replyHandler reply: @escaping @Sendable (FSItem?, FSFileName?, (any Error)?) -> Void)func createSymbolicLink(named name: FSFileName, inDirectory directory: FSItem, attributes newAttributes: FSItem.SetAttributesRequest, linkContents contents: FSFileName) async throws -> (FSItem, FSFileName)Parameters
- 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.
- reply:
A block or closure to indicate success or failure. If creation succeeds, pass the newly-created Fsitem and a
nilerror. If creation fails, pass the relevant error as the second parameter; FSKit ignores any Fsitem in this case. For anasyncSwift implementation, there’s no reply handler; simply return the Fsitem 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.