iDevGames Forums
Creating directories for save games - Printable Version

+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Tools & Technology (/forum-10.html)
+--- Thread: Creating directories for save games (/thread-8114.html)



Creating directories for save games - xiotex - Sep 17, 2010 04:47 AM

I need to be able to save the player's progress in the game. What is the preferred way of creating directories under OSX? I would prefer a C++ solution to this but if it has to be Cocoa then so be it. My basic assumption at this point is that it should be saved to ~/Library/Application Support/<game name> but how in code can you create a directory at that location?


RE: Creating directories for save games - ThemsAllTook - Sep 17, 2010 06:37 AM

For the POSIX way, man 2 mkdir

mkdir man page Wrote:#include <sys/stat.h>

int
mkdir(const char *path, mode_t mode);

For the Cocoa way, see NSFileManager

NSFileManager documentation Wrote:- (BOOL)createDirectoryAtPath:(NSString *)path withIntermediateDirectories:(BOOL)createIntermediates attributes:(NSDictionary *)attributes error:(NSError **)error



RE: Creating directories for save games - PowerMacX - Sep 17, 2010 06:56 PM

Also Cocoa:
http://cocoawithlove.com/2010/05/finding-or-creating-application-support.html


RE: Creating directories for save games - xiotex - Sep 18, 2010 01:46 AM

I was using mkdir already so I guess I will stick with it.

Thanks for the reassurance.