Permalink
Browse files

Fixes #166 Create uninstaller for PhoneGapInstaller

  • Loading branch information...
1 parent f63c9e4 commit 0097a9451984fd81da1292a700b2b39af842711a @shazron shazron committed Jul 13, 2011
Showing with 52 additions and 0 deletions.
  1. +1 −0 Makefile
  2. +51 −0 Uninstall PhoneGap.applescript
View
@@ -121,6 +121,7 @@ installer: clean phonegap-lib xcode3-template xcode4-template phonegap-framework
@textutil -convert rtf PhoneGapInstaller/docs/*.html
@echo "Building PhoneGapInstaller.pkg..."
@$(PACKAGEMAKER) -d PhoneGapInstaller/PhoneGapInstaller.pmdoc -o PhoneGapInstaller.pkg > /dev/null 2> $(PKG_ERROR_LOG)
+ @osacompile -o Uninstall\ Phonegap.app Uninstall\ PhoneGap.applescript > /dev/null 2>> $(PKG_ERROR_LOG)
@echo "Done."
@make clean
@@ -0,0 +1,51 @@
+-- PhoneGap Uninstaller for Mac OS X
+-- MIT Licensed
+-- Copyright 2011 Nitobi Software Inc.
+
+set question to display dialog "Uninstall PhoneGap?" buttons {"Yes", "No"} default button 2 with icon caution
+set answer to button returned of question
+
+if answer is equal to "Yes" then
+ tell application "Finder" to set home_path to home as text
+ tell application "Finder" to set startup_hd to startup disk as string
+
+ -- delete Xcode 3 Template
+ set source to (home_path & "Library:Application Support:Developer:Shared:Xcode:Project Templates:PhoneGap")
+ tell application "Finder"
+ if exists folder source then
+ delete source
+ end if
+ end tell
+ -- delete Xcode 4 Template
+ set source to (home_path & "Library:Developer:Xcode:Templates:Project Templates:Application:PhoneGap-based Application.xctemplate")
+ tell application "Finder"
+ if exists folder source then
+ delete source
+ end if
+ end tell
+ -- delete PhoneGapLib (used by Xcode 3 Template, and generating PhoneGap.framework if need be)
+ set source to (home_path & "Documents:PhoneGapLib")
+ tell application "Finder"
+ if exists folder source then
+ delete source
+ end if
+ end tell
+ -- delete PhoneGap.framework (used by Xcode 4 Template) and its parent directories
+ set source to (startup_hd & "Users:Shared:PhoneGap")
+ tell application "Finder"
+ if exists folder source then
+ delete source
+ end if
+ end tell
+ -- delete symlink to PhoneGap.framework
+ set source to (home_path & "Library:Frameworks:PhoneGap.framework")
+ tell application "Finder"
+ if exists file source then
+ delete source
+ end if
+ end tell
+ -- end
+ display dialog "PhoneGap uninstalled." buttons {"Goodbye ☹"} with icon note
+else
+ display dialog "Phew!" buttons {"That was close ☺"} with icon note
+end if

0 comments on commit 0097a94

Please sign in to comment.