macOS File and Custom URL Scheme Associations

From Free Pascal wiki
Revision as of 11:06, 23 May 2020 by Trev (talk | contribs) (More macOS content - work in progress :-)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search
macOSlogo.png

This article applies to macOS only.

See also: Multiplatform Programming Guide

Warning-icon.png

Warning: Work in progress...

Overview

macOS does not have a central registry like Windows to which applications explicitly write information. Instead, every application with a graphical interface has a property list file named Info.plist, roughly equivalent to a manifest in the Windows world, stored in its application bundle. The Info.plist file (optionally) includes file type association and custom URL scheme information.

macOS Launch Services is an API that enables a running application to open other applications or their document files in a way similar to the Finder or the Dock. Using Launch Services, an application can perform such tasks as:

  • Open (launch or activate) another application
  • Open a document or a URL (uniform resource locator) in another application
  • Identify the preferred application for opening a given document or URL
  • Register information about the kinds of document files and URLs an application is capable of opening
  • Obtain appropriate information for displaying a file or URL on the screen, such as its icon, display name, and kind string
  • Maintain and update the contents of the Recent Items menu

Launch Services automatically registers an application with the database the first time the application becomes known to the system. This can occur when:

  • The Finder reports an application has been added to the Applications folder.
  • An application installer is run.
  • When a document is opened that has no preferred application, the user is asked to select an application to use, and that application is registered with Launch Services.
  • When the built-in Launch Services tool is run whenever you boot your Mac or login as a user. This tool scans the Applications folder looking for any new applications that have been placed there.

When you open a document or URL, Launch Services is used to determine which application should open the item. Launch Services uses the following specific order:

  • If the user has manually set a file association, then Launch Services will use that application to open the document or URL.
  • If the document has a file name extension, Launch Services will find all applications that list the extension as compatible.
  • If the document has a four-character file type, Launch Services finds all applications that accept that file type.
  • If more than one application is found, then:
    • If the document has a four-character creator type that matches an application:
      • Give preference to applications on the boot volume;
      • Give preference to applications on local volumes rather than remote volumes.
  • If two or more applications still meet the criteria, give preference to the newest version.


To Be Continued ...


See also

  • t/c

External links