Re: How to tell if a file is busy?
Re: How to tell if a file is busy?
- Subject: Re: How to tell if a file is busy?
- From: Chris Nebel <email@hidden>
- Date: Wed, 26 Sep 2001 23:49:35 -0700
- Organization: Apple Computer, Inc.
David Simerly wrote:
>
on 9/26/01 1:30 AM, Chris Page at email@hidden wrote:
>
>
> Where exactly does "info for" get this flag from? AFAIK, applications are
>
> not responsible for setting a "busy" flag on files. Perhaps "info for" gets
>
> this from the kioFlAttribFileOpenBit flag in ioFlAttrib of HFileInfo, in
>
> which case the problem for AppleScripts is probably that a lot of
>
> applications open, read, then close files that are "open" in the UI, but
>
> don't keep the actual file open the whole time the "document" is "open", if
>
> you see what I mean.
>
>
Well, my understanding is that it was a new bit that Apple added at the
>
release of system 9, and that the idea was for applications to set it when
>
they open a document.
No, Chris Page has it right. The "busy" field in "info for" is simply the
kioFlAttribFileOpenBit flag, which the file system sets whenever a file is
open. No application support is required, and the bit has been there ever since
Mac OS 1.0. The only new thing about it in Mac OS 9 was that we exposed it in
"info for".
The difficulty, as Chris points out, is that some applications don't leave the
disk file open while the document is "open". The file system is telling the
truth -- the file itself is not busy, and anyone is free to read from or write
to it, but the application that opened the file earlier may stomp on your
changes later.
--Chris Nebel
AppleScript Engineering