Instance Method


Interprets the receiver as a path in the file system and attempts to perform filename completion, returning a numeric value that indicates whether a match was possible, and by reference the longest path that matches the receiver.


- (NSUInteger)completePathIntoString:(NSString * _Nullable *)outputName caseSensitive:(BOOL)flag matchesIntoArray:(NSArray<NSString *> * _Nullable *)outputArray filterTypes:(NSArray<NSString *> *)filterTypes;



Upon return, contains the longest path that matches the receiver.


If YES, the method considers case for possible completions.


Upon return, contains all matching filenames.


An array of NSString objects specifying path extensions to consider for completion. Only paths whose extensions (not including the extension separator) match one of these strings are included in outputArray. Pass nil if you don’t want to filter the output.

Return Value

0 if no matches are found and 1 if exactly one match is found. In the case of multiple matches, returns the actual number of matching paths if outputArray is provided, or simply a positive value if outputArray is NULL.


You can check for the existence of matches without retrieving by passing NULL as outputArray.

Note that this method only works with file paths (not, for example, string representations of URLs).

See Also

Working with Paths

+ pathWithComponents:

Returns a string built from the strings in a given array by concatenating them with a path separator between each pair.


The file-system path components of the receiver.


A file system-specific representation of the receiver.

- getFileSystemRepresentation:maxLength:

Interprets the receiver as a system-independent path and fills a buffer with a C-string in a format and encoding suitable for use with file-system calls.


A Boolean value that indicates whether the receiver represents an absolute path.


The last path component of the receiver.


The path extension, if any, of the string as interpreted as a path.


A new string that replaces the current home directory portion of the current path with a tilde (~) character.

- stringByAppendingPathComponent:

Returns a new string made by appending to the receiver a given string.

- stringByAppendingPathExtension:

Returns a new string made by appending to the receiver an extension separator followed by a given extension.


A new string made by deleting the last path component from the receiver, along with any final path separator.


A new string made by deleting the extension (if any, and only the last) from the receiver.


A new string made by expanding the initial component of the receiver to its full path value.


A new string made from the receiver by resolving all symbolic links and standardizing path.


A new string made by removing extraneous path components from the receiver.

- stringsByAppendingPaths:

Returns an array of strings made by separately appending to the receiver each string in a given array.