In the past if you wanted to include data in your command line app, you could either include it in a separate file or do some linker trickery to embed it. Personally, I never really got into the linker trickery (though it’s probably the better solution of the two).
For a while, though, Xcode has supported a build option Create Info.plist Section In Binary, also known as
CREATE_INFOPLIST_SECTION_IN_BINARY. If on, this will embed the target’s Info.plist into the executable as a data segment.
I couldn’t find any documentation on how to get it out, though. After a lot of searching, I came up with
getsectbyname. This is defined in mach-o/getsect.h like so:
Continue reading “Info.plist for command line tools”