Re: Best Place To Save States
Re: Best Place To Save States
- Subject: Re: Best Place To Save States
- From: Ondra Cada <email@hidden>
- Date: Fri, 28 Apr 2006 17:52:41 +0200
Jerrod,
On 28.4.2006, at 17:42, Jerrod Fowkes wrote:
Hello, I need the ability to save off a state for my application.
For small amount of information use NSUserDefaults.
For big one put files into ~/Library/Application Support/<your app
signature>/whatever:
+(NSString*)applicationSupportFolderBaseName {
NSString *p=[NSSearchPathForDirectoriesInDomains
(NSApplicationSupportDirectory, NSUserDomainMask, YES) lastObject];
if (!p) // should never happen, but let's stay at the safe side
p=[@"~/Library/Application Support" stringByStandardizingPath];
return p;
}
+(NSString*)applicationSupportFolderName {
return [[self applicationSupportFolderBaseName]
stringByAppendingPathComponent:[[NSBundle mainBundle]
bundleIdentifier]];
}
Note: though it is kind of customary to use the app name instead of
signature there, *don't*. That way, more apps may clash and make a
nice mess in "shared" folder.
My question is, where is the best place to create this file? is
just tilde slash a good place?
No. Users would be rightily infuriated.
Is it the standard to throw in a blank file in the resources and
then I can write and read to that?
Am not sure what "resources" are, but presumed the Resources folder
in the application bundle, it would not work at all: in any half-
decent setup, application bundles are *not* writeable.
---
Ondra Čada
OCSoftware: email@hidden http://www.ocs.cz
private email@hidden http://www.ocs.cz/oc
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden