Where Are My Files?

Prometheus
Unregistered
 
Post: #1
Q: Porting from Windows to Mac. Using XCode. I have a bunch of folders of game content to load. Can't figure out how to get my app to set its working/current directory to the one with all the content!

I've heard of a legendary document called "Where's My File?" that used to be on a site called "onesadcookie". But it seems that site went down, and came back up without said tip article.

BUT... it is on Google Cache.

However, it is about setting the path to a "resources directory" that is established somewhere in XCode. (?) What are "resources" in this context, exactly?

I feel like I'm missing a major piece of the puzzle? (gee, what are the odds!) Do most Mac apps pack their resources internally somehow? What's the standard practice for loadin' stuff? Is it "bad" to have all the content in open directories?

Where do babies come from? Shock

K, ignore that last one. Rolleyes
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #2
Most apps store their resources in normal files (pngs, etc) below the Resources directory in the application bundle. If you add pngs to your Xcode project, this is where they'll be put by default.

In the Finder, choose "show package contents" from the contextual menu on any of the Applications in /Applications and have a look around. It'll be instructional.
Quote this message in a reply
Prometheus
Unregistered
 
Post: #3
Sweet, thanks a lot!

I've managed to include files in 'Resources' and load them... but it appears that the directory structure I've built within my XCode project's 'Resources' folder isn't preserved. (all the files are at the root of 'Resources' in the final package) I've noticed that other games have nested directories in their 'Resources' folder in their package... Does some option have to be enabled to allow this, or am I doing something wrong? Shock

EDIT: Solved: info here
(create folder references!)

Go nub power!
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #4
Unfortunately, the folder reference thing doesn't work either -- you have to do a clean build whenever a file within a folder reference changes.

This is an area where Xcode is completely unhelpful, unfortunately.

If you search the boards you'll find a script to use in a shell script build phase to copy resources, preserving hierarchy.
Quote this message in a reply
Moderator
Posts: 522
Joined: 2002.04
Post: #5
OneSadCookie Wrote:Unfortunately, the folder reference thing doesn't work either -- you have to do a clean build whenever a file within a folder reference changes.

This is an area where Xcode is completely unhelpful, unfortunately.
I've heard you say that before, but it's worked perfectly for me in a couple of projects. So that's my anecdotal evidence to balance things out. Smile

-Jon
Quote this message in a reply
Prometheus
Unregistered
 
Post: #6
It preserved the hierarchy for me!

I also added a "copy files" build step thing (as per that site I linked to) don't know if that had anything to do with it.
Quote this message in a reply
Post Reply