archiveRootObject:toFile: always overwrites?
archiveRootObject:toFile: always overwrites?
- Subject: archiveRootObject:toFile: always overwrites?
- From: Ron Fleckner <email@hidden>
- Date: Fri, 18 May 2007 09:51:49 +1000
Hi list,
in - applicationShouldTerminate: I do the following:
NSString *favDataPath = [NSString stringWithFormat:@"%@fav.data",
appSupportPath];
[NSKeyedArchiver archiveRootObject:[self favouritesList]
toFile:favDataPath];
favouritesList is an NSMutableArray of NSMenuItems.
When I unarchive the fav.data file at next startup, everything is
fine. The new data is indeed the data I archived the last time the
app shut down whether the new data is smaller or larger than the data
which existed before the write (archive) operation.
My question:
Is what I'm doing reliable, or should I be zeroing the old data file
first? I can find no description of the behaviour of
archiveRootObject:toFile: in the docs for NSKeyedArchiver about this
question.
I hope that makes sense.
Any opinion from an experienced Cocoa coder would be helpful.
Ron
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden