Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

kcjones

macrumors newbie
Original poster
Aug 4, 2008
8
0
Hey Everyone,

My question is how do I get the bundle path in c++. Something similar to:

[[NSBundle mainBundle] pathForResource:mad:"image" ofType:mad:"png"]

How do I get the full path of a resource in the Application bundle in char[].

Thanks for your help!
 

kcjones

macrumors newbie
Original poster
Aug 4, 2008
8
0
Ok I've now got:

Code:
	CFBundleRef mainBundle = CFBundleGetMainBundle();
        CFURLRef resourcesURL = CFBundleCopyBundleURL(mainBundle);
	
	CFShow(resourcesURL); // prints full bundle path to console
	
	CFRelease(resourcesURL);

How do I get the resourcesURL to a string and append something to it?
 

kcjones

macrumors newbie
Original poster
Aug 4, 2008
8
0
Don't worry about it I got it:

Code:
        CFBundleRef mainBundle = CFBundleGetMainBundle();
        CFURLRef resourcesURL = CFBundleCopyBundleURL(mainBundle);
	CFStringRef str = CFURLCopyFileSystemPath( resourcesURL, kCFURLPOSIXPathStyle );
	CFRelease(resourcesURL);
	char path[PATH_MAX];
	
	CFStringGetCString( str, path, FILENAME_MAX, kCFStringEncodingASCII );
	CFRelease(str);
	fprintf(stderr, path);
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.