Xojo example project
An example Xojo project to show how to deal with application directories on macOS. Why that?
macOS Catalina (and newer) consists of two Volumes:
- a read-only System volume
- a read-write Data volume
So the classic /Applications
directory is now the one where users can store their system-wide available applications. Apple's own System Applications will be in another location.
Finder transparently shows them just as Applications
. However, Developers might need to get the correct native path. But Xojo only provides a single folder using SpecialFolder.Applications
...
The included examples show how to:
- Find Applications
- by BundleID (the preferred way)
- by AppName (this will try to find it in all possible system defined application directories)
- Get an Array of standard/default Folders defined by Apple (see the Enumeration:
NSSearchPathDirectory
).- This way you will get all ones (also the per-user Application Folder, if it exists) from the OS.
- Get an answer to the following questions:
- Which available application(s) can open a Document?
An example is included which will ask you to select a Document. It then locates all suitable Applications, depending on theLSRolesMask
(s) you specify.
- Which available application(s) can open a Document?
- Which available application(s) can deal with a given URL?
- Another example locates Applications that can deal with any given URL (e.g. list all WebBrowsers).
Example application: macOS App Directories
Xojo is a rapid application development for Desktop, Web, Mobile & Raspberry Pi.
The Desktop application Xojo example project macOS-App-Directories.xojo_project
is using:
- Xojo 2023r4
- API 2
- Copy the Module
modMacOSAppDirectories
from the example project, and paste it into your project. - Study the example project to learn how to use the provided methods in the Module.
Juerg Otter is a long term user of Xojo and working for CM Informatik AG. Their Application CMI LehrerOffice is a Xojo Design Award Winner 2018. In his leisure time Juerg provides some bits and pieces for Xojo Developers.
Do you like this project? Does it help you? Has it saved you time and money?
You're welcome - it's free... If you want to say thanks I'd appreciate a message or a small donation via PayPal.