Data folder on iPhone / xcode

At the moment if you open an iOS OF example the data folder is a group within xcode.

I believe if you have two files with the same name, in different folders within data on disk, as they are in a group in xcode when they get bundled the same names cause issues.

Xcode offers two options when you add a directory to the project. You can either add it as the default yellow ‘group’ or as a blue ‘folder reference’. The problem is, that both have pretty major limitations (and bugs).

The group option will never notice if the directory contents are added or removed. Every time you add or remove a file or directory in the file system, you will also have to change it in Xcode. Also, the directory structure is lost when it’s copied to the iphone app, and so inside your app bundle is just a big list of all your resources in the base directory. As a result of this, duplicate filenames become an issue. If any files within your directory structure on disk contain the same filename, the build process silently screws everything up. It appears to be ‘first in wins’, with only one of the resources making it into the app bundle. So it’s no good if you have a bunch of different level packages each containing a different ‘Terrain.png’ file.

How to setup folder references
http://struct.ca/2010/xcode-folder-references/

There is some info here about how to have a little script that will update files in the ‘copy bundle resources’
http://majicjungle.com/blog/123/

So I deleted my data folder, re added my data folder but chose to make it a folder resource rather than a group (so its blue not yellow).

Then I put a Run script above the order of ‘copy bundle resources’ that has:
touch ${SRCROOT}data

I noticed in the OF projects we don’t have a “Copy Files” process in our Targets. Does this copy the files into xcode? Or is this if you have your data outside of your application folder? I’m a little confused.

Does anyone else have a method for dealing with this?

Thanks

Sorry I needed up bump this thread.

How does anyone else making stuff for iPhone / iPad do their data folder stuff?

Thanks

I’m not sure I completely understand the question, but I can say what I do.

For anything related to OF, I just stick assets (images, sound, etc) in the data folder and don’t do anything in xcode. But, if you need to use the files in interface builder or objective-c, I’ve found that I normally have to drag them into the data folder or resources folder in xcode. Otherwise, the obj-c code won’t see them. I haven’t had 2 files with the same name in different locations before, so I’m not the best to answer that.

Just a quick note: folder reference is nice as you don’t have to keep dragging the files in.

Otherwise if you don’t want to have to mod the project, just drag the files from the data folder into the xcode sidebar. then they should be added normally.