Re: NSDocument annoying warning
Re: NSDocument annoying warning
- Subject: Re: NSDocument annoying warning
- From: Quincey Morris <email@hidden>
- Date: Mon, 17 Nov 2008 22:14:36 -0800
On Nov 17, 2008, at 21:12, Randall Meadows wrote:
So, to "lock" the document, I get the current name, change the
extension, use NSFileManager to move the file from the "unlocked"
name to the "locked" name, call -setFileType: to the locked type,
and call -setFileURL: with the new, locked pathname converted to an
NSURL. When I then save the document, I get the following:
"This document has been renamed to "newname"
It will be saved under this new name, or you can provide another name.
[Save As] [Cancel] [Save]"
The code used to use -setFileName: instead, but that's deprecated in
10.5 (as of 10.4 actually).
Shirley there must be some way to tell the system "yes, I'm changing
this file name, yes, the user is already aware of it and would
appreciate you not annoying the living snot out of him by informing
him of this useless detail."
Calling -setFileModificationDate: had a similar affect on my other
issue (that is, nothing) but I used the other suggestion and moved
the actually modification of the bundle contents to the save
function, and that took care of that problem.
It's all a bit puzzling, but I notice the following in the NSDocument
documentation:
initWithContentsOfURL:ofType:error:
Initializes a document located by a URL of a specified type.
...
Discussion
...
This method is invoked by the NSDocumentController method
makeDocumentWithContentsOfURL:ofType:error:. The default
implementation of this method invokes init,
readFromURL:ofType:error:, setFileURL:, setFileType:, and
setFileModificationDate:.
So if you're trying to lock your document in the obvious place (a
readFromURL:ofType:error: override) then your setFileURL and
setFileModificationDate invocations are, according to this, going to
be clobbered unless you override initWithContentsOfURL:ofType:error:
too.
Is that any help?
P.S. And don't call me "Shirley".
_______________________________________________
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