Re: Saving an NSDocument safely
Re: Saving an NSDocument safely
- Subject: Re: Saving an NSDocument safely
- From: "Adam R. Maxwell" <email@hidden>
- Date: Fri, 11 Jan 2008 08:24:45 -0800
On Jan 11, 2008, at 6:57 AM, Alastair Houghton wrote:
On 11 Jan 2008, at 10:47, Thomas Thiriez wrote:
I have an NSDocument, and in order to save it, I override the method:
-
saveToURL:ofType:forSaveOperation:delegate:didSaveSelector:contextInfo
:
In order not to lose the original file until I am sure saving was
completed properly, I save in a temporary file, and when this is
done,
I delete the original file, and rename my temporary file.
Aren't you re-inventing the wheel here? Doesn't the framework
already do this?
Yes, the framework does this in -[NSDocument writeSafelyToURL:..].
Using FSExchangeObjects doesn't result in the problem the OP mentions,
but the temp file and destination file have to reside on the same
volume. I had to write my own implementation of writeSafelyToURL:
yesterday since 10.5's safe saving is broken.
--
adam
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please 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