Instance Method

selectFile:inFileViewerRootedAtPath:

Selects the file specified by fullPath.

Declaration

- (BOOL)selectFile:(NSString *)fullPath inFileViewerRootedAtPath:(NSString *)rootFullPath;

Parameters

fullPath

The full path of the file to select.

rootFullPath

If a path is specified, a new file viewer is opened. If you specify an empty string (@"") for this parameter, the file is selected in the main viewer.

Return Value

YES if the file was successfully selected; otherwise, NO.

Discussion

In macOS 10.5 and later, this method does not follow symlinks when selecting the file. If the fullPath parameter contains any symlinks, this method selects the symlink instead of the file it targets. If you want to select the target file, use the stringByResolvingSymlinksInPath method to resolve any symlinks before calling this method.

It is safe to call this method from any thread of your app.

See Also

Manipulating Files

- duplicateURLs:completionHandler:

Duplicates the specified URLS asynchronously in the same manner as the Finder.

- recycleURLs:completionHandler:

Moves the specified URLs to the trash in the same manner as the Finder.

- performFileOperation:source:destination:files:tag:

Performs a file operation on a set of files in a particular directory.

Deprecated
- activateFileViewerSelectingURLs:

Activates the Finder, and opens one or more windows selecting the specified files.

NSWorkspaceFileOperationName

These constants specify different types of file operations used by performFileOperation:source:destination:files:tag:.

Deprecated
File Types

These constants specify different types of files returned by the getInfoForFile:application:type: method.