Re: Application that uninstalls itself
Re: Application that uninstalls itself
- Subject: Re: Application that uninstalls itself
- From: James Bucanek <email@hidden>
- Date: Tue, 4 Jan 2011 08:37:50 -0700
eveningnick eveningnick <mailto:email@hidden> 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 (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