Loading files from the project directory
If you're (say) working on an xml parser and you want to load some test files from the project directory and perhaps you're using otest and the senTesting framework...
Set-up your tests in the normal way. (Apple has a pdf that tells you how to do this.)
Set the executable's path to that of your project. In my case the executable is "otest" because I'm testing a framework. (Note: The default path for the executable is the build directory, so I guess you could use ../xml/ if you need the path to be the build dir.)
In your test code (let's pretend my xml files are in a subdirectory of my project called xml), you can do something like this in your test code:
NSURL *fileURL = [[NSURL alloc] initFileURLWithPath:\
[@"./xml/2006-08-28 14;14;17.xml" stringByStandardizingPath]];
Since -[NSString stringByStandardizingPath] knows that "./" means "this here directory, yo" it will expand the path for you. This makes your test code all kinds of happily portable for when you release source to the rest of th e world. <--- I'll be choosing a (GPL or LGPL) license and doing that sometime this week for those of you who want to use my super awesome nike+ ipod cocoa objective-c objc xml parser (The previous string is for Googlebot... chew on *that*)