Mike K pointed me in the right direction के बाद, मैं के साथ एक आवेदन बंडल में एक फ़ाइल का पथ को पुनः प्राप्त करने में सक्षम था निम्नलिखित कोड।
// Get a reference to the main bundle
CFBundleRef mainBundle = CFBundleGetMainBundle();
// Get a reference to the file's URL
CFURLRef imageURL = CFBundleCopyResourceURL(mainBundle, CFSTR("MyImage"), CFSTR("bmp"), NULL);
// Convert the URL reference into a string reference
CFStringRef imagePath = CFURLCopyFileSystemPath(imageURL, kCFURLPOSIXPathStyle);
// Get the system encoding method
CFStringEncoding encodingMethod = CFStringGetSystemEncoding();
// Convert the string reference into a C string
const char *path = CFStringGetCStringPtr(imagePath, encodingMethod);
fprintf(stderr, "File is located at %s\n", path);
ऐसा लगता है कि यह होने की अपेक्षा थोड़ा लंबा लगता है, लेकिन कम से कम यह काम करता है!
स्रोत
2012-01-07 08:27:04