eveningnick eveningnick <mailto:eveningn...@gmail.com> wrote (Monday, January 3, 2011 8:48 AM +0200):

In any sane operating system it is impossible (at least, directly) for
an application to remove a file that is running.
Hence i am searching for a detour.

Who said OS X / BSD had to sane?

As others have already pointed out, you can unlink/delete a file while it is still open by another process. The file will continue to exist until the file is closed, at which time it will really be delete from the file system. Think of files as objects with reference counts.

In my application, I have a special "Uninstall and Quit" menu item. I shutdown and delete launchd configuration files and them move the active components (plug-ins, helpers, ...) to the trash. I find this avoid the problem of deleting files that are part of a bundle (for the plug-ins) that is still in use, and my customers like the transparency of seeing what was removed and being given the control over when they're ultimately deleted.
--
James Bucanek

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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 arch...@mail-archive.com

Reply via email to