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: Checking file modification dates in NSDocument



On 7/28/06, Sanford Selznick <email@hidden> wrote:

I wonder if this will handle users renaming/moving files that
NSDocument has "open".

That's not a bug, it's a feature! :) Why should I have to close a document just to rename it or move it somewhere else? I like that (some) apps are automatically made aware of such changes.

[The following omits details and glosses over semantics in the hopes
of portraying a basic understanding of what the perceived problems are
-- caveat lector].

Typically, in UNIX-derived systems, one can (permissions allowing and
with certain exceptions) move anything out 'from under' something else
that's using the file.  The process that opened the file originally
still has a handle to the data that was represented by the file path
at the time of opening, regardless of underlying changes to the file
since that time.  Any further read actions you perform will be handled
in the context of the original data, even if someone else has since
written to the path where the file used to exist.

Keeping a file open doesn't even stop someone from deleting the file.
Try opening a file in TextEdit or vi, saving it to the Desktop, then
trashing said file (and emptying the trash).  This is allowed
behaviour in general, and is in fact a feature in certain contexts.

The trick is to remember that the file path and the data at the inode
represented by said path are two different things.  You can read the
data through a path, but once you've got the inode reference, you
don't need the path anymore, and indeed said path can be manipulated,
but your data reference still works in the meantime.

J.
_______________________________________________
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: Checking file modification dates in NSDocument (From: "Jordan Krushen" <email@hidden>)
 >Re: Checking file modification dates in NSDocument (From: "Jordan Krushen" <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.