View Full Version : Read/Write To Package Contents?
Apr 15, 2009, 08:25 AM
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:
NSString *textFile = @"/Developer/Applications/Xcode/Contents/Resources/myTextFile.txt";
Apr 16, 2009, 01:32 AM
It sounds like:
[[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.
Apr 16, 2009, 03:09 AM
Writing to the application bundle will break code signing, if you use it. It's generally not recommended.