On 27 Oct 2010, at 13:16, eveningnick eveningnick wrote:

> Hello
> I have an application that creats, when installed, a bundle in
> "Applications" and registers a .plist file for launchd in
> ~/Library/LaunchAgents (the agent is located in that bundle, and its
> process is launched everytime the OS starts).
> Thus, i can't let a user just to move bundle to the Trash bin, when he
> wants to get rid of it. Thats why, in a "control panel" of my
> application, i placed a button "Uninstall", which
> 1) stops the Agent
> 2) deletes the plist file
> 3) [should delete the bundle]
> 
> This control panel is located in this bundle, that has to be deleted.
> And in Mac OS 10.6 a bundle whose application is running can't be
> deleted.
> What could i do here to delete the bundle? What is usually done in such cases?
> o) After "uninstalling", ask user to manually move bundle to a trash
> bin, and then terminate control panel application? Seems pathetic,
> especially when user already pressed "Uninstall".
> o) Copy a "bundle-deleting script" to the "autorun once", that will
> launch next time with the next system boot? It seems like a good idea,
> but could it be done somehow without leaving traces afterwards?
> o) Copy to some "autocleanined" (like temp or something) folder a
> script, launch it and terminate control application. That script will
> wait, till the control app is terminated , and then remove the bundle.
> But does such a folder exist in MacOS? and how could it possibly be
> done?
> 
> I don't want to rubbish  the user's Mac, if he/she doesn't like my App :)
> 


Have you considered just killing the background process and then automatically 
moving your app to the trash before quitting?
It's simple and most end users understand the idea of old apps ending up in the 
trash. (If they even notice it at all)

(Using NSWorkspace)


Alternatively using launchd and WatchPaths to watch for the user moving your 
app out of its proper location 
and then automatically kill the background process and delete the launchd 
scripts.

I believe Sparkle uses the first approach to replace existing applications 
while Steam on the Mac does something like the latter.




Angus




_______________________________________________

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