> where is the recommended place for a mac application to store user-
> specific data and files? Which API do I use to determine the path from
> a c++ app ?
If the user is opening and saving them, then on first launch, you might
default to ~/Documents. After that, let the open and save dialog boxes
keep track of the history of recently used folders.
For auxiliary files, ~/Library/Application Support/ is the place. Most
conies make a sub folder in there and put their application's stuff in
the subfolder.
APIs: from C++, you can use either Carbon or Cocoa, but Carbon is
easiest.
Use the FSFindFolder(kLocalDomain, kApplicationSupportFolderType, TRUE,
&fsRef); system call to get an FSRef, then use FSRefMakePath() from
Files.h to get a full path. That way, you won't have to worry of the
user runs your app on a non-English system.
FSRef fsRef = {0};
char path[2048] = {0};
if(noErr == FSFindFolder(kLocalDomain, kApplicationSupportFolderType,
TRUE, &fsRef) &&
noErr == FSRefMakePath(&fsRef, (UInt8*)path, sizeof path)) {
// path is initialized here.
}
Ben Artin - 26 Sep 2007 15:36 GMT
> > where is the recommended place for a mac application to store user-
> > specific data and files? Which API do I use to determine the path from
> > a c++ app ?
[...]
> Use the FSFindFolder(kLocalDomain, kApplicationSupportFolderType, TRUE,
> &fsRef); system call to get an FSRef, then use FSRefMakePath() from
> Files.h to get a full path. That way, you won't have to worry of the
> user runs your app on a non-English system.
kLocalDomain is wrong for user-specific files, you meant kUserDomain.

Signature
If this message helped you, consider buying an item
from my wish list: <http://artins.org/ben/wishlist>
I changed my name: <http://periodic-kingdom.org/People/NameChange.php>
David Phillip Oster - 27 Sep 2007 04:01 GMT
> > Use the FSFindFolder(kLocalDomain, kApplicationSupportFolderType, TRUE,
> > &fsRef);
>
> kLocalDomain is wrong for user-specific files, you meant kUserDomain.
oops. Thank you. I'm sure you are right.
mlabs - 30 Sep 2007 02:08 GMT
what do I link to in my makefile if i'm usinf FSFindFolder? in
general, how do you figure this out? the apple docs usually specify a
header but no lib...
Michael Ash - 30 Sep 2007 02:29 GMT
> what do I link to in my makefile if i'm usinf FSFindFolder? in
> general, how do you figure this out? the apple docs usually specify a
> header but no lib...
Go to the top of the Folder Manager Reference, which is the page which
contains the FSFindFolder document. There you will see that it resides in
the CoreServices framework. So add -framework CoreServices to your compile
and link flags.

Signature
Michael Ash
Rogue Amoeba Software
> where is the recommended place for a mac application to store user-
> specific data and files?
<http://developer.apple.com/documentation/MacOSX/Conceptual/BPFileSystem/
index.html>
> Which API do I use to determine the path from
> > a c++ app ?
<http://developer.apple.com/documentation/MacOSX/Conceptual/BPFileSystem/
Articles/Domains.html#//apple_ref/doc/uid/20002281-101591-BAJCBACI>
Reinder