NSArchiver atomic?

2009-03-29 Thread Michael Vannorsdel
Does anyone know if NSArchiver's archive to file methods do atomic file writes? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at

Re: NSArchiver atomic?

2009-03-29 Thread Jim Correia
On Mar 29, 2009, at 5:39 AM, Michael Vannorsdel wrote: Does anyone know if NSArchiver's archive to file methods do atomic file writes? Yes - anyone who has read the API documentation for those methods knows whether or not they write the files atomically. Jim

Re: NSArchiver atomic?

2009-03-29 Thread Michael Ash
On Sun, Mar 29, 2009 at 2:57 PM, Michael Vannorsdel mikev...@gmail.com wrote: Guess I should clarify.  Has anyone verified it; I've had an issue with partial writes archiving built-in classes.  The program used to get signals to terminate and archive some basic classes (NSArray, NSString,

Re: NSArchiver atomic?

2009-03-29 Thread Michael Vannorsdel
Guess I should clarify. Has anyone verified it; I've had an issue with partial writes archiving built-in classes. The program used to get signals to terminate and archive some basic classes (NSArray, NSString, NSNumber) to disk. But these files would only contain some of the archive

Re: NSArchiver atomic?

2009-03-29 Thread Michael Vannorsdel
Yes no surprise.. But if NSArchiver is indeed atomic I would think the saved file would either be saved complete with new data or complete old data and not with partial data in situations like an untimely crash or resource loss. Unless I have the wrong expectation of atomic file writes,

Re: NSArchiver atomic?

2009-03-29 Thread Clark Cox
All bets are off if you do unsupported things inside of a signal handler. For instance it is possible that the routines used to write the file *seemed* to complete successfully when they, in fact, didn't. In which case the code went along its merry way and did the rename. On Sun, Mar 29, 2009 at

Re: NSArchiver atomic?

2009-03-29 Thread Michael Vannorsdel
Alright thanks, what I was looking for. On Mar 29, 2009, at 1:41 PM, Clark Cox wrote: All bets are off if you do unsupported things inside of a signal handler. For instance it is possible that the routines used to write the file *seemed* to complete successfully when they, in fact, didn't. In

Re: NSArchiver atomic?

2009-03-29 Thread Dave Keck
From the docs: + (BOOL)archiveRootObject:(id)rootObject toFile:(NSString *)path ... writeToFile:atomically:, using path for the first argument and YES for the second. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin