Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Changing file & directory names



Hi!

2 jul 2006 kl. 09.27 skrev Matt Neuburg:

On Sat, 01 Jul 2006 21:39:52 -0400, Dean Snyder <email@hidden> 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.

...
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.

Then I suppose all file attributes are clered with this save operation? The actuall process of saving (if an old file exists) would then include getting old attributes with fileAttributesAtPath, then writeRTFDToFile and lastly changeFileAttributes back to the previous attributes (but with the new modification date). However, I think this feels strange, but since you observed -[NSString writeToFile] work similar, it is perhaps a normal behaviour.


/Rog
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >Re: Changing file & directory names (From: Matt Neuburg <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.