FROM : Matt Neuburg
DATE : Sun Jul 02 09:27:21 2006
On Sat, 01 Jul 2006 21:39:52 -0400, Dean Snyder <dean.<email_removed>> said:
>If I change the contents of the file and save it (using NSTextView
>writeRTFDToFile), but do not rename/move the file, then both the
>creation date and the modification date are changed to reflect the time
>the file was saved. That is clearly wrong behavior - only the
>modification date should be changed.
I don't think so. writeRTFDtoFile never promised you a rose garden. It is
not a "save" action in the sense you are imagining: it is a "create a file"
action (happily overwriting an existing file if so commanded). You'll find
that -NSString writeToFile:..., for example, is just the same way. And
rightly so; this is a completely new file. The file that was there before,
by the same name, could be anything; nothing guarantees that it is the "same
document". That notion is just something you made up.
If you want a "save" action, where there *is* a notion of the "same
document", as in the document architecture, then either *use* the document
architecture (which does the right thing for you) or be prepared to manage
more of the housekeeping yourself.
m.
--
matt neuburg, phd = <email_removed>, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
<http://www.amazon.com/gp/product/0596102119>
DATE : Sun Jul 02 09:27:21 2006
On Sat, 01 Jul 2006 21:39:52 -0400, Dean Snyder <dean.<email_removed>> said:
>If I change the contents of the file and save it (using NSTextView
>writeRTFDToFile), but do not rename/move the file, then both the
>creation date and the modification date are changed to reflect the time
>the file was saved. That is clearly wrong behavior - only the
>modification date should be changed.
I don't think so. writeRTFDtoFile never promised you a rose garden. It is
not a "save" action in the sense you are imagining: it is a "create a file"
action (happily overwriting an existing file if so commanded). You'll find
that -NSString writeToFile:..., for example, is just the same way. And
rightly so; this is a completely new file. The file that was there before,
by the same name, could be anything; nothing guarantees that it is the "same
document". That notion is just something you made up.
If you want a "save" action, where there *is* a notion of the "same
document", as in the document architecture, then either *use* the document
architecture (which does the right thing for you) or be prepared to manage
more of the housekeeping yourself.
m.
--
matt neuburg, phd = <email_removed>, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
<http://www.amazon.com/gp/product/0596102119>






Cocoa mail archive

