Creating directories for save games

Apprentice
Posts: 7
Joined: 2009.08
Post: #1
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?
Quote this message in a reply
Moderator
Posts: 1,560
Joined: 2003.10
Post: #2
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
Quote this message in a reply
Moderator
Posts: 771
Joined: 2003.04
Post: #3
Quote this message in a reply
Apprentice
Posts: 7
Joined: 2009.08
Post: #4
I was using mkdir already so I guess I will stick with it.

Thanks for the reassurance.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Fullscreen GL with Save Panel on top unknown 7 4,089 Dec 12, 2006 09:41 PM
Last Post: Frogblast
  Open/Save As versus Import/Export? WhatMeWorry 1 3,334 Jan 15, 2006 09:33 PM
Last Post: OneSadCookie