Storing stuff inside the app bundle

I have an application that will basically replace, say, 20 of Safari’s interface images to give it a different look.

I was planning on having 4 folders of images (2 copies of the originals (an earlier and a later, depending on the version of Safari), and 2 copies of the modified images) stored inside the application bundle itself in the /Contents/Resources/ folder. I’d then use a ditto shell script to copy the files from there to inside the Safari bundle.

I added the 4 folders to the “Resources” folder in Xcode, but when I build the app, all the images appear to be consolidated directly inside of the /Contents/Resources/ folder, and appear to overwrite each other so that I’m left with only one folder’s worth.

While I realize I can always add the images to the bundle later on, I’m wondering if there might be some sort of setting or way to configure the structure of the app bundle from within Xcode so that the 4 folders are used like I intended.

Thanks in advance for any ideas…

Organize your images into folders before your add them to your project then when you ad them to your project (I like to just drag and drop into the Resources group of the Groups & Files pane), make sure you check “Copy items into destination group’s folder…” and then click the radio button for “Create folder References for any added folders”. Now in the groups and files list your new folder should be blue to indicate it is an actual folder instead of a symbolic group (designated by yellow). When you build the project, these folders will be created as subfolders in the Resources folder of the bundle.

Jon

Jon,

How would you go about referencing those files in your script in order to say duplicate that folder to the desktop, for example?


Ross

It’s just a path like anything else so, say you’d copied a folder to your project called “stuff” and placed it in the Resources group. Then, in your code, to copy that to the desktop, just add:

Jon


[This script was automatically tagged for color coded syntax by Convert Script to Markup Code]

Cool, thanks Jon.

I figured there ought to be a way… I was doing exactly that, I just had to switch the radio button to “Create folder References for any added folders” instead of the default.

Thats great stuff jon. Thanks!

Ross