Having to build an app and bundle it with an Info.plist
can sometimes be inconvenient.
A while ago I found out it is possible to bundle your Info.plist
directly into a section in the executable by adding the following to your linker options:
-sectcreate __TEXT __info_plist ../../source/Mac/Info.plist
With some trial and error it seems that it is possible to create such a section directly in code using the __attribute__
syntax.
Note that when you include an Info.plist normally you can use variables $(PRODUCT_NAME)
which get expanded at some point during the bundling process, if you decided to use this for real you’d have to work around that?
Further questions:
- How problematic is it in practice to not have
$(PRODUCT_NAME)
etc. variables / what workarounds are there? - If you have Info.plist data both in the executable and the .app bundle, which takes precedence?
- Is this a terrible idea, what problems can it cause?