Re: file done writing?
Re: file done writing?
- Subject: Re: file done writing?
- From: "Gary L. Wade" <email@hidden>
- Date: Sun, 10 Apr 2011 22:18:52 -0700
- Thread-topic: file done writing?
If you have full control of both applications, try making the writer do
its work on a temporary file and move it in place when done. Look at the
atomic writing messages that do a flavor of this. You might find the
FSEvents mechanism something to consider if you're watching a dump folder
where the originator application is something you have no control over.
There are also very-Darwin-level mechanisms for seeing if a file is open,
but those are not guaranteed to remain the same from one patch release to
the next. Also, getting back to your open-test mechanism, see if it is
not possible to move a file that's open; if that guarantees only to work
if the file is not opened, then maybe you should try moving the file to a
"waiting room" folder to work on it.
On 04/10/2011 10:04 PM, "Rainer Standke" <email@hidden> wrote:
>Thanks Scott,
>
>this is helpful and good to know. In the meantime I have played a little
>with lsof on the command line, and it seems to sort of answer the
>question wether or not someone has a file open with authority... but it's
>very slow.
>
>Just to enlighten me, why can't there be no absolute way to know when a
>file has been completed? I'm not doubting you, just trying to learn... is
>it because you can't predict what's going to happen right the second
>after you look?
>
>Your idea to have the other app flag me makes a lot of sense to me,
>thanks again,
>
>Rainer
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden