Create Subfolders In Resource Directory

This should be a simple question, but I can't find any answers to it! In my iPhone project I'm trying to create sub directories inside the resource directory of my bundle, but the resources always end up in the bundle's root directory.
The only way I was able to get this to work was to create a new "Copy Files Build Phase" for each sub-directory I want to create. But there has to be an easier way, right?

Any suggestions?

macbook, Mac OS X (10.5.3)

Posted on Aug 25, 2008 8:12 AM

Reply
5 replies

Aug 25, 2008 10:56 AM in response to probablycorey

Let's start with a basic question - do you really need the resources in subdirectories within the deployed application? It's one thing to keep resources all nice and organized into groups within Xcode. It's another to want or need such organization in the deployed application.

This exact question was asked recently and the answer I recall from that post is - don't worry about it. Keep it neat in Xcode but there is no reason to care if it's all flat in the deployed app.

But that's why I asked the first question. Does your app depend on resources being in subdirectories at runtime?

Aug 25, 2008 6:42 PM in response to RickMaddy

To give you one example: my app has 2D grid with tiles that are generated by a Python script outside Xcode and then placed in the resource directory before compilation. Each tile as 8 distinct files, so I group them in a directory.

The app itself spiders through all the tiles at startup to create a data structure for each tile.

It could also have been solved by having a certain filename or create a plist with all the tiles, but this just was the most convenient way to do.

BTW, to the original poster: Xcode won't pick up dependencies on this. If you change files inside the directory and it's not a known file type, it won't update already present files in the build directory, so you'll have to a make clean before compiling. This has bitten me multiple times...

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Create Subfolders In Resource Directory

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.