Re: Best approach to write an uninstaller for osx
Re: Best approach to write an uninstaller for osx
- Subject: Re: Best approach to write an uninstaller for osx
- From: Parimal Das <email@hidden>
- Date: Tue, 24 Nov 2009 20:00:31 +0530
hello again
>From what i understood till now, i have written some Applescript (my first)
to do the uninstall.
My approach here is-
1. I have two Application Bundles (created from Script Editor)-
Uninstall.app and DeleteAll.app
2. Delete.app resides inside the "Resources" of Uninstall.app.
3. When we double click Uninstall.app it fires a script(given below),
4. This script copies DeleteAll.app to /private/tmp/ AND then runs
DeleteAll.app from Temp location.
The Script is
===========
on run
set tempPath to "/private/tmp/fromTemp.app" as string
set pathToMe to (path to me)
set pathpath to my GetParentPath(pathToMe)
set ourPath to POSIX path of pathpath as string
set ourPath to ourPath & "fromTemp.app" as string
do shell script "sudo cp -R '" & ourPath & "' '" & tempPath & "'" with
administrator privileges
do shell script "sleep 10;
/private/tmp/fromTemp.app/Contents/MacOS/applet; >/dev/null 2>&1 &" with
administrator privileges
end run
on GetParentPath(theFile)
tell application "Finder" to return container of theFile as text
end GetParentPath
==========
Here I am expecting, that Uninstall.app will be closed after it has copied
and launched DeleteAll.app.
But it is waiting for DeleteAll to complete, and it exits after that.
Also DeleteAll.app is deleting MyApp + UninstallApp.
And DeleteAll will be removed at the next system restart (as it is in temp)
What i want to ask now is
1. Is this approach correct.
2. How i can exit from Uninstaller.app before the start of Deleteall.app
Any other suggestions/insights ???
Lots of thanks.
-Parimal
On Tue, Nov 24, 2009 at 1:22 AM, Kyle Sluder <email@hidden> wrote:
> On Sat, Nov 21, 2009 at 4:50 PM, Jens Alfke <email@hidden> wrote:
> > Sure, you can do that. As I said, there's no particular trick for
> deleting the uninstaller. The filesystem won't stop you from deleting your
> own binary (or moving it to the trash.)
>
> The filesystem doesn't care, but the OS sure as heck does. Launch
> Services and CoreServices both freak out if a running app goes
> bye-bye—to the Trash or anywhere else.
>
> --Kyle Sluder
>
--
--
Warm Regards,
Parimal Das
_______________________________________________
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