User data on Mac

BlitzMax Forums/BlitzMax Programming/User data on Mac

GfK(Posted 2010) [#1]
Where should I be saving game data to on MacOS?

In windows I'm using SHGetSpecialFolderLocation API to determine the correct folder for data which is to be local to the current user, or shared among all users.

What's the Mac equivalent of this?


Brucey(Posted 2010) [#2]
What's the Mac equivalent of this?

Specifically, I've no idea. I just use my volumes module to remember things like that :-)


GfK(Posted 2010) [#3]
Actually I downloaded that shortly after I started this thread, but wanted to wait to see if anybody replied first.

Are there any permissions gotchas with shared user folders on Mac like there are on Windows?


Brucey(Posted 2010) [#4]
Shared user folders should be okay... as long as you aren't setting any permissions yourself.
I'd expect any files created in there would have default permissions of 766 (rwxrw-rw-), which would let anyone have read/write access to them.

Some things to note on Mac... generally all application resources stay inside the app bundle - which the user installs into /Applications or wherever. In your shared folders I guess you might have things like high-score tables etc. And perhaps in the users' own area, their saved games (if any). But of course it depends on the software what things you are more likely to share :-)
Things like downloadable maps I'd imagine you'd also put into the shared area...


N(Posted 2010) [#5]
http://developer.apple.com/mac/library/documentation/MacOSX/Conceptual/BPFileSystem/Articles/WhereToPutFiles.html

http://developer.apple.com/mac/library/documentation/Cocoa/Reference/Foundation/Classes/NSFileManager_Class/Reference/Reference.html#//apple_ref/occ/instm/NSFileManager/URLsForDirectory:inDomains:
(Not a link because BRL needs to fix their forum)

These should help. Former explains where to put different kinds of files (you want Application Support), latter is the API you're going to use to get at it. Shouldn't take more than one or two lines of code.


GfK(Posted 2010) [#6]
Thanks for the info - will have a play tomorrow (I'm back in Windows atm).