Re: Checking file modification dates in NSDocument
Re: Checking file modification dates in NSDocument
- Subject: Re: Checking file modification dates in NSDocument
- From: "Jordan Krushen" <email@hidden>
- Date: Fri, 28 Jul 2006 14:26:47 -0700
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:
This email sent to email@hidden