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

Darkroom

Guest
Original poster
Dec 15, 2006
2,445
0
Montréal, Canada
is it not possible to read/write to "Package Contents" paths (or whatever they're called)? i'd like to write a program that writes a file to the applications resources folder. using XCode as an example:

Code:
NSString *textFile = @"/Developer/Applications/Xcode/Contents/Resources/myTextFile.txt";
 

larkost

macrumors 6502a
Oct 13, 2007
534
1
It sounds like:
Code:
[[NSBundle mainBundle] resourcePath]
would get you what you want, but I am going to really, really recommend against doing this if you are going to write to that location. A much better target would be to write out to folders in ~/Library/Cache or ~/Library/Application Support. Or you could write out to the a folder in the users /var/folders folder (use confstr() with _CS_DARWIN_USER_TEMP_DIR, to get that). But I would caution against that last one, as it is not commonly known to users that that exists, and filling up their drive in a spot they are not likely to find is likely to make them angry.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.