Skip navigation.
 
mlRe: Changing file & directory names
FROM : Frode
DATE : Sun Jul 02 11:17:24 2006

Hi!

2 jul 2006 kl. 09.27 skrev Matt Neuburg:

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

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

Related mailsAuthorDate
mlChanging file & directory names Dean Snyder Jul 1, 19:23
mlRe: Changing file & directory names Greg Titus Jul 1, 19:26
mlRe: Changing file & directory names Dean Snyder Jul 1, 19:41
mlRe: Changing file & directory names Sherm Pendley Jul 1, 20:15
mlRe: Changing file & directory names John Stiles Jul 1, 21:18
mlRe: Changing file & directory names Dean Snyder Jul 1, 21:28
mlRe: Changing file & directory names John Stiles Jul 1, 21:40
mlRe: Changing file & directory names Sherm Pendley Jul 1, 21:41
mlRe: Changing file & directory names Sherm Pendley Jul 1, 21:47
mlRe: Changing file & directory names Dean Snyder Jul 1, 21:57
mlRe: Changing file & directory names John Stiles Jul 1, 22:13
mlRe: Changing file & directory names Sherm Pendley Jul 1, 23:10
mlRe: Changing file & directory names Sherm Pendley Jul 1, 23:19
mlRe: Changing file & directory names Rosyna Jul 2, 02:26
mlRe: Changing file & directory names Derrick Bass Jul 2, 02:28
mlRe: Changing file & directory names Sherm Pendley Jul 2, 03:21
mlRe: Changing file & directory names Dean Snyder Jul 2, 03:39
mlRe: Changing file & directory names Chris Suter Jul 2, 03:47
mlRe: Changing file & directory names Dean Snyder Jul 2, 03:54
mlRe: Changing file & directory names Adam R. Maxwell Jul 2, 09:16
mlRe: Changing file & directory names Matt Neuburg Jul 2, 09:27
mlRe: Changing file & directory names Frode Jul 2, 11:17
mlRe: Changing file & directory names John Stiles Jul 2, 18:20
mlRe: Changing file & directory names Sean McBride Jul 4, 18:07
mlRe: Changing file & directory names Adam R. Maxwell Jul 4, 18:41
mlRe: Changing file & directory names Andy Lee Jul 5, 03:11