• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How to tell if a file is busy?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to tell if a file is busy?


  • Subject: Re: How to tell if a file is busy?
  • From: "Bob.Kalbaugh" <email@hidden>
  • Date: Thu, 27 Sep 2001 14:32:02 -0500

on 9/27/01 11:14 AM, John W Baxter at email@hidden wrote:

> At 23:49 -0700 9/26/2001, Chris Nebel wrote:
>> 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.
>
> Or maybe not...BBEdit for one works hard to avoid it. Do some
> experimenting with SimpleText and BBEdit
> 1. Create a file with SimpleText...save and close it.
> 2. Open the file in BBEdit
> 3. Open the file in BBEdit...make a change and save and close the file.
> 4. Observe that BBEdit has picked up the change.
> 5. Now make a change in BBEdit but don't save it.
> 6. Open the file in SimpleText, make a change, and save and close the file.
> 7. BBedit alerts that the file has been changed, but that it hasn't
> updated its file content to match because of its own unsaved changes
> (paraphrased heavily). At this point, the user decides which changes to
> discard.
>
> BBEdit 6.1.2...I forget how far back this behavior goes. But for an app
> which doesn't hold the file open for writing while potentially changing it,
> this is at least semi-decent behavior.
>
> --John

Interesting thread. I hope I'm staying on topic. A short time ago I queried
the list relating to this in a subject titled: [ Error writing file - when
file is open ]. I've noted the same behavior from BBEdit 6.0. My problem
concerned writing to a file from a script when the file was already open. I
had wrote in a trap to handle error -49 (file already open). Well, if the
file was open in Simpletext the trap worked fine. In BBedit (the above
behavior - I was allowed to write to the file but I got the same alert) In
Tex-Edit Plus -to use Chris's terms- it stomped all over my file. Out of
curiousity I just tried it with Appleworks. Once again...Splat!, flat as a
pancake.

So who's to know what apps do the stomping and those that don't, without a
lot of testing? Are there better traps to use or better ways to write the
file, in this event?

Though I did get -one- reply to my earlier post (off-list) the suggestion
was to create my file as read only and it's not what I had in mind. Would
locking the file help? Can you write to a file that is locked from a script?
Would you have to un-lock it first? Oh nevermind, I'll jes try it. But if
anyone has some thoughts to share on better ways to write/trap a file in the
first place...mucho appreciato!

_bob.kalbaugh


References: 
 >Re: How to tell if a file is busy? (From: John W Baxter <email@hidden>)

  • Prev by Date: cgi's /scripts not handling the first event passed to them
  • Next by Date: Re: Scripting Startup Disk?
  • Previous by thread: Re: How to tell if a file is busy?
  • Next by thread: Re: How to tell if a file is busy?
  • Index(es):
    • Date
    • Thread