Instance Method

createSymbolicLinkAtURL:withDestinationURL:error:

Creates a symbolic link at the specified URL that points to an item at the given URL.

Declaration

- (BOOL)createSymbolicLinkAtURL:(NSURL *)url withDestinationURL:(NSURL *)destURL error:(NSError * _Nullable *)error;

Parameters

url

The file URL at which to create the new symbolic link. The last path component of the URL issued as the name of the link.

destURL

The file URL that contains the item to be pointed to by the link. In other words, this is the destination of the link.

error

On input, a pointer to an error object. If an error occurs, this pointer is set to an actual error object containing the error information. You may specify nil for this parameter if you do not want the error information.

Return Value

YES if the symbolic link was created or NO if an error occurred. This method also returns NO if a file, directory, or link already exists at url.

Discussion

This method does not traverse symbolic links contained in destURL, making it possible to create symbolic links to locations that do not yet exist. Also, if the final path component in url is a symbolic link, that link is not followed.

See Also

Related Symbols

- createSymbolicLinkAtPath:withDestinationPath:error:

Creates a symbolic link that points to the specified destination.