Instance Method

getInfoForFile(_:application:type:)

Retrieves information about the specified file.

Declaration

func getInfoForFile(_ fullPath: String, application appName: AutoreleasingUnsafeMutablePointer<NSString?>?, type: AutoreleasingUnsafeMutablePointer<NSString?>?) -> Bool

Parameters

fullPath

The full path to the desired file.

appName

The app the system would use to open the file.

type

On input, a pointer to a string object variable; on return, if the method is successful, this variable contains a string object with the filename extension or encoded HFS file type of the file.

Return Value

true if the information was retrieved successfully; otherwise, false if the file could not be found or the app was not associated with the file.

Discussion

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

See Also

Requesting Information

func urlForApplication(toOpen: URL) -> URL?

Returns the URL to the default app that would be used to open the given URL.

func fullPath(forApplication: String) -> String?

Returns the full path for the specified app.

Deprecated
func isFilePackage(atPath: String) -> Bool

Determines whether the specified path is a file package.

var frontmostApplication: NSRunningApplication?

Returns the frontmost app, which is the app that receives key events.

var runningApplications: [NSRunningApplication]

Returns an array of NSRunningApplication representing the running apps.

var menuBarOwningApplication: NSRunningApplication?

Returns the app that owns the currently displayed menu bar.