'Easily writing Bundles

How can I write bundles in Cocoa without much "fuzz" around it? I just want to have a bundle with an Info.plist, a Contents Folder, and that folder should contain a couple of files.



Solution 1:[1]

Then just make one:

mkdir My.bundle
cd My.bundle
mkdir Contents
cd Contents
touch Info.plist
mkdir Resources
open Info.plist

That should get you started nicely.

Edit: You run this in Terminal.app, of course.

Solution 2:[2]

You can also use file wrappers, assuming you're using Cocoa and not Cocoa Touch.

Create the bundle out of file wrappers from the inside out, with every directory and file being modeled by a file wrapper. Then, write the outermost file wrapper to the bundle URL.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Williham Totland
Solution 2 Peter Hosey