Re: Is a file open in another application?
Re: Is a file open in another application?
- Subject: Re: Is a file open in another application?
- From: Conrad Shultz <email@hidden>
- Date: Sat, 19 Mar 2011 11:40:59 -0700
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 3/19/11 11:10 AM, Kyle Sluder wrote:
> On Sat, Mar 19, 2011 at 9:13 AM, Conrad Shultz
> <email@hidden> wrote:
>> Note that this will only capture files that are properly opened (i.e.
>> fopen()'d), so you won't catch every apparently open file. For example,
>> if you open a file in vi(m), it creates a hidden scratch file in the
>> same directory and closes the original file. You then edit the scratch
>> file, which is only written out to the original file on save. In this
>> way, the original file is protected from damage due to a crash, but lsof
>> will almost never show it as being open.
>
> This is also how Cocoa apps work. They only keep the file open to read
> its contents.
>
> I'm afraid that what Brad wants to do is not possible yet.
Are you certain that is a general behavior?
For example, I have Preview open right now, and it very much lists all
its open files:
iodine:~ shultzc$ lsof -p 1379 | grep pdf
Preview 1379 shultzc txt REG 14,2 189325 9688581
/Users/shultzc/Downloads/758206463.pdf
Preview 1379 shultzc txt REG 14,2 91087 9682563
/Users/shultzc/Downloads/jo001518o.pdf
Preview 1379 shultzc txt REG 14,2 492849 9684998
/Users/shultzc/Downloads/pat5925487.pdf
Preview 1379 shultzc txt REG 14,2 818740 9682461
/Users/shultzc/Downloads/103_34.pdf
Ditto for Pages:
iodine:~ shultzc$ lsof -p 13384 | grep pages
Pages 13384 shultzc 13r REG 14,2 93930 7814760
/Users/shultzc/develop/Synthetiq/forms/2010-09-14_Apple_fax.pages
I _do_ see that OmniFocus uses a cache instead of the underlying
database (kudos!), but unfortunately I don't actually have Office, so I
can't test the OP's scenario.
But it does seem from the above that this can be handled in an
implementation-specific manner, no? (Please forgive my ignorance, I
develop mostly with iOS.)
- --
Conrad Shultz
Synthetiq Solutions
www.synthetiqsolutions.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iD8DBQFNhPi7aOlrz5+0JdURAv9MAJ4td5dC1YGAsfX8CQaKWObWWAUNNQCcCHnT
r1e4FtZkwiC923cmmDcnxCE=
=amxm
-----END PGP SIGNATURE-----
_______________________________________________
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