I am currently working directly with Cocoa for the first time to built a screen saver. Now I came across a problem when trying to load resources from within the .saver
bundle. I basically have a small C++ wrapper class to load .exr
files using freeImage
. This works as long as I use absoulte paths, but that's not very useful, is it? So, basically, I tried everything: putting the .exr
file at the level of the .saver
bundle itself, inside the bundles Resources folder, and so on.
Then I simply tried to load the .exr
like this, but without success:
particleTex = [self loadExrTexture:@"ball.exr"];
I also tried making it go to the .saver
bundles location like this:
particleTex = [self loadExrTexture:@"../../../ball.exr"];
...to maybe load the .exr
from that location, but without success.
I then came across this:
NSString * path = [[NSBundle mainBundle] pathForResource:@"ball" ofType:@"exr"];
const char * pChar = [path UTF8String];
...which seems to be a common way to find resources in Cocoa, but for some reason it's empty in my case. Any ideas about that? I really tried out anything that came to my mind without success so I would be glad about some input!