CFURLCreateCopyAppendingPathComponent(_:_:_:_:)
Creates a copy of a given URL and appends a path component.
Declaration
func CFURLCreateCopyAppendingPathComponent(_ allocator: CFAllocator!, _ url: CFURL!, _ pathComponent: CFString!, _ isDirectory: Bool) -> CFURL!Parameters
- allocator:
The allocator to use to allocate memory for the new
CFURLobject. PassNULLor Kcfallocatordefault to use the current default allocator. - url:
The
CFURLobject to which to append a path component. - pathComponent:
The path component to append to
url. - isDirectory:
A Boolean value that specifies whether the string is treated as a directory path when resolving against relative path components. Pass
trueif the new component indicates a directory,falseotherwise.
Return Value
A copy of url appended with pathComponent. Ownership follows the create rule. See The Create Rule.
Discussion
The isDirectory argument specifies whether or not the new path component points to a file or a to directory. Note that the URL syntax for a directory and for a file at otherwise the same location are slightly different—directory URLs must end in “/”. If you have the URL http://www.apple.com/foo/ and you append the path component bar, then if isDirectory is true then the resulting URL is http://www.apple.com/foo/bar/, whereas if isDirectory is false then the resulting URL is http://www.apple.com/foo/bar. This difference is particularly important if you resolve another URL against this new URL. file.html relative to http://www.apple.com/foo/bar is http://www.apple.com/foo/file.html, whereas file.html relative to http://www.apple.com/foo/bar/ is http://www.apple.com/foo/bar/file.html.
See Also
Creating a CFURL
CFURLCopyAbsoluteURL(_:)CFURLCreateAbsoluteURLWithBytes(_:_:_:_:_:_:)CFURLCreateByResolvingBookmarkData(_:_:_:_:_:_:_:)CFURLCreateCopyAppendingPathExtension(_:_:_:)CFURLCreateCopyDeletingLastPathComponent(_:_:)CFURLCreateCopyDeletingPathExtension(_:_:)CFURLCreateFilePathURL(_:_:_:)CFURLCreateFileReferenceURL(_:_:_:)CFURLCreateFromFileSystemRepresentation(_:_:_:_:)CFURLCreateFromFileSystemRepresentationRelativeToBase(_:_:_:_:_:)CFURLCreateFromFSRef(_:_:)CFURLCreateWithBytes(_:_:_:_:_:)CFURLCreateWithFileSystemPath(_:_:_:_:)CFURLCreateWithFileSystemPathRelativeToBase(_:_:_:_:_:)CFURLCreateWithString(_:_:_:)