To run a GUI application on macOS we use macOS application bundles. The application bundle is actually just a directory with name like MyApplication.app
and some standard organization for executable, icons, data.
When running the application during development we create a temporary application bundle, using symlinks to actual files (so it will be created lighting fast, even if you have large game data, as we will not copy data — only symlink to it). This applies to running application from CGE editor, or when using castle-engine run
on the command-line.
When packaging the application we also create an application bundle, this time by really copying the files/dirs into proper places. This gives you MyApplication.app
that is ready to be distributed to users. This applies when packaging from CGE editor, or when using castle-engine package
from the command-line. You can also request the application bundle format explicitly, using CGE editor menu item "Run → Package → macOS App Bundle (APP) zip", or on command-line castle-engine package --package-format=mac-app-bundle-zip
.
Note
|
You can disable using application bundle by setting mac_app_bundle="false" in the CastleEngineManifest.xml. Disabling it makes sense for command-line (not GUI) applications.
|
Behavior of the data directory (castle-data:
protocol) on macOS, if the application detects it is being run through the "application bundle":
-
We expect the data to be found inside MyApplication.app/Contents/Resources/data
subdirectory. This way user can move around MyApplication.app
to move, install and uninstall the application.
When creating application bundle, we (CGE editor and CGE build tool) make sure to make project data actually present there, so things should Just Work and you don’t need to do anything.
-
If the MyApplication.app/Contents/Resources/data
subdirectory is not found, we will use the data
subdirectory that is sibling to MyApplication.app
. This feature is intended to be used only during development with Lazarus. This way things work "out of the box" if you run through Lazarus, with checkbox “Use Application Bundle for running and debugging” in Lazarus project options.