views:

208

answers:

3

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.

A: 

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.

Williham Totland
Is there a cocoa-only way of doing this, one that uses Cocoa Classes , if possible?
Tristan Seifert
+3  A: 

If you are simply looking to create directories with Cocoa, check out NSFileManager. It has the method:

-createDirectoryAtPath:withIntermediateDirectories:attributes:error:

I also assume that you have read - Bundle Programming Guide

This guide will provide you with the complete anatomy of a bundle.

ericgorr
+1  A: 

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.

Peter Hosey