update the script

This commit is contained in:
Mengjuei 2011-10-20 23:38:06 -07:00
parent 130ec614dd
commit ec66ad6385
1 changed files with 11 additions and 10 deletions

View File

@ -64,7 +64,7 @@ class InstallerAppDelegate(NSObject):
def agreeLicenseAction_(self, sender): def agreeLicenseAction_(self, sender):
self.window.orderOut_(None) self.window.orderOut_(None)
from subprocess import call from subprocess import call
call(["killall", "McBopomofo"]) call(["/usr/bin/killall", "McBopomofo"])
inputMethodDir = os.path.expanduser("~/Library/Input Methods") inputMethodDir = os.path.expanduser("~/Library/Input Methods")
if os.path.exists(inputMethodDir) is False: if os.path.exists(inputMethodDir) is False:
@ -74,18 +74,19 @@ class InstallerAppDelegate(NSObject):
McBopomofoPath = os.path.join(inputMethodDir, "McBopomofo.app") McBopomofoPath = os.path.join(inputMethodDir, "McBopomofo.app")
if os.path.exists(McBopomofoPath) is True: if os.path.exists(McBopomofoPath) is True:
try: try:
shutil.rmtree(McBopomofoPath) call(["/bin/cp", "-R", packagePath, McBopomofoPath])
except: except:
NSRunAlertPanel(NSLocalizedString("Failed to install McBopomofo!", ""), NSRunAlertPanel(NSLocalizedString("Failed to install McBopomofo!", ""),
NSLocalizedString("Failed to remove existing installation.", ""), NSLocalizedString("Failed to overwrite existing installation.", ""),
NSLocalizedString("OK", ""), None, None) NSLocalizedString("OK", ""), None, None)
try: else:
shutil.copytree(packagePath, McBopomofoPath) try:
except: shutil.copytree(packagePath, McBopomofoPath)
NSRunAlertPanel(NSLocalizedString("Failed to install McBopomofo!", ""), except:
NSLocalizedString("Failed to copy application.", ""), NSRunAlertPanel(NSLocalizedString("Failed to install McBopomofo!", ""),
NSLocalizedString("OK", ""), None, None) NSLocalizedString("Failed to copy application.", ""),
NSApp.terminate_(self) NSLocalizedString("OK", ""), None, None)
NSApp.terminate_(self)
print McBopomofoPath print McBopomofoPath
try: try: