On Feb 17, 2009, at 10:25 AM, Gustavo Vera wrote:

I'm trying to get status info from a file on disk, to be more precise, I
need to know if the file is currently destination of a regular copy
operation.

According to this Tech Note <http://developer.apple.com/technotes/tn/tn2037.html >, the frameworks always use advisory locking with an exclusive lock when opening a file for writing, if that feature is supported. If the Finder is using the frameworks or is otherwise participating in advisory locking, you can attempt to open the file with a lock of your own to test if any other process has an exclusive lock.

This doesn't work for programs which are not participating in the advisory locking scheme -- those that use the BSD/POSIX APIs and don't follow that Tech Note's advice -- but it's better than nothing.

Cheers,
Ken

_______________________________________________

Cocoa-dev mailing list ([email protected])

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to