Something wrong with the python code

This commit is contained in:
Mengjuei 2012-03-20 22:27:03 -07:00
parent abfcbe4a4e
commit b3803637ba
1 changed files with 90 additions and 83 deletions

View File

@ -72,9 +72,16 @@ class InstallerAppDelegate(NSObject):
packagePath = NSBundle.mainBundle().pathForResource_ofType_("McBopomofo", "app") packagePath = NSBundle.mainBundle().pathForResource_ofType_("McBopomofo", "app")
McBopomofoPath = os.path.join(inputMethodDir, "McBopomofo.app") McBopomofoPath = os.path.join(inputMethodDir, "McBopomofo.app")
WrongPath = os.path.join(McBopomofoPath, "McBopomofo.app")
if os.path.exists(WrongPath) is True:
try:
shutil.rmtree(WrongPath)
except:
"""do nothing"""
if os.path.exists(McBopomofoPath) is True: if os.path.exists(McBopomofoPath) is True:
try: try:
call(["/bin/cp", "-R", packagePath, McBopomofoPath]) call(["/bin/cp", "-R", packagePath, inputMethodDir])
except: except:
NSRunAlertPanel(NSLocalizedString("Failed to install McBopomofo!", ""), NSRunAlertPanel(NSLocalizedString("Failed to install McBopomofo!", ""),
NSLocalizedString("Failed to overwrite existing installation.", ""), NSLocalizedString("Failed to overwrite existing installation.", ""),