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

john903

macrumors member
Original poster
Apr 11, 2008
66
0
What directory should your program use to save files? Do you just find your installation path or is there some other path developers are supposed to use to store files?
 

kainjow

Moderator emeritus
Jun 15, 2000
7,958
7
Use NSSearchPathForDirectoriesInDomains() along with NSDocumentDirectory to get the Documents folder for your application.
 

Sbrocket

macrumors 65816
Jun 3, 2007
1,250
0
/dev/null
Code:
NSString *basePath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];

That will give you the appropriate Documents/ directory path for your application. You should store any files you need saved between sessions (or otherwise) there.
 

john903

macrumors member
Original poster
Apr 11, 2008
66
0
Thanks! I'm able to get the path but it looks like the folder is given permissions that are not allowing me to save files to the folder using fopen. Am I doing something wrong or do I need to change the permissions on the folder?

Also, the name of the application folder, such as like CE9E47A8-38DC-4DDD-A0AA-93E0666DB241 keeps changing every time the program loads. Is that what's supposed to happen?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.