From beed28efe8090d30126890988e2801e6922e539b Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Sun, 25 Jun 2023 23:02:59 +0800 Subject: [PATCH] Main // Hardcode the InputMethodConnectionName. --- Source/Modules/main.swift | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Source/Modules/main.swift b/Source/Modules/main.swift index 07186e0b..4f674cf6 100644 --- a/Source/Modules/main.swift +++ b/Source/Modules/main.swift @@ -36,22 +36,23 @@ default: exit(0) } guard let mainNibName = Bundle.main.infoDictionary?["NSMainNibFile"] as? String else { - NSLog("Fatal error: NSMainNibFile key not defined in Info.plist.") + NSLog("vChewingDebug: Fatal error: NSMainNibFile key not defined in Info.plist.") exit(-1) } let loaded = Bundle.main.loadNibNamed(mainNibName, owner: NSApp, topLevelObjects: nil) if !loaded { - NSLog("Fatal error: Cannot load \(mainNibName).") + NSLog("vChewingDebug: Fatal error: Cannot load \(mainNibName).") exit(-1) } +let kConnectionName = Bundle.main.infoDictionary?["InputMethodConnectionName"] as? String ?? "org.atelierInmu.inputmethod.vChewing_Connection" + guard let bundleID = Bundle.main.bundleIdentifier, - let kConnectionName = Bundle.main.infoDictionary?["InputMethodConnectionName"] as? String, let server = IMKServer(name: kConnectionName, bundleIdentifier: bundleID) else { NSLog( - "Fatal error: Cannot initialize input method server with connection name retrieved from the plist, nor there's no connection name in the plist." + "vChewingDebug: Fatal error: Cannot initialize input method server with connection name retrieved from the plist, nor there's no connection name in the plist." ) exit(-1) } @@ -60,7 +61,7 @@ guard let mainBundleInfoDict = Bundle.main.infoDictionary, let strUpdateInfoSource = mainBundleInfoDict["UpdateInfoEndpoint"] as? String, let urlUpdateInfoSource = URL(string: strUpdateInfoSource) else { - NSLog("Fatal error: Info.plist wrecked. It needs to have correct 'UpdateInfoEndpoint' value.") + NSLog("vChewingDebug: Fatal error: Info.plist wrecked. It needs to have correct 'UpdateInfoEndpoint' value.") exit(-1) }