Skip navigation.
 
mlSaving an NSDocument safely
FROM : Thomas Thiriez
DATE : Fri Jan 11 11:47:03 2008

Hello,

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.

While this work fine in 10.4, with 10.5, the next time I try saving
the file, I get the message 'The location of the document "mydoc"
cannot be determined'.

It seems that the NSDocument is confused by the fact that the file has
diasppeared, even though a new one has taken its place.

Is there a way to tell the NSDocument that the new file is really the
one that was saved? Otherwise, is there another way to make sure the
file was saved properly before losing the original one?

Thanks,
Thomas

Related mailsAuthorDate
mlSaving an NSDocument safely Thomas Thiriez Jan 11, 11:47
mlRe: Saving an NSDocument safely Alastair Houghton Jan 11, 15:57
mlRe: Saving an NSDocument safely Adam R. Maxwell Jan 11, 17:24
mlRe: Saving an NSDocument safely Adam R. Maxwell Jan 11, 23:16