LMMgr // Fix openPhraseFile().

- This is only needed in mainstream releases.
This commit is contained in:
ShikiSuen 2023-11-01 11:29:58 +08:00
parent f9f0c21b9e
commit 3fbb0b418f
2 changed files with 3 additions and 3 deletions

View File

@ -311,7 +311,7 @@ public extension LMMgr {
} }
static func openUserDictFile(type: vChewingLM.ReplacableUserDataType, dual: Bool = false, alt: Bool) { static func openUserDictFile(type: vChewingLM.ReplacableUserDataType, dual: Bool = false, alt: Bool) {
let appIdentifier: String = alt ? "" : "Finder" let appIdentifier: String = alt ? "com.apple.TextEdit" : "com.apple.finder"
openPhraseFile(fromURL: userDictDataURL(mode: IMEApp.currentInputMode, type: type), appIdentifier: appIdentifier) openPhraseFile(fromURL: userDictDataURL(mode: IMEApp.currentInputMode, type: type), appIdentifier: appIdentifier)
guard dual else { return } guard dual else { return }
openPhraseFile(fromURL: userDictDataURL(mode: IMEApp.currentInputMode.reversed, type: type), appIdentifier: appIdentifier) openPhraseFile(fromURL: userDictDataURL(mode: IMEApp.currentInputMode.reversed, type: type), appIdentifier: appIdentifier)
@ -326,7 +326,7 @@ public extension LMMgr {
if !Self.checkIfUserFilesExistBeforeOpening() { return } if !Self.checkIfUserFilesExistBeforeOpening() { return }
DispatchQueue.main.async { DispatchQueue.main.async {
switch appIdentifier { switch appIdentifier {
case "Finder": case "Finder", "com.apple.finder":
NSWorkspace.shared.activateFileViewerSelecting([url]) NSWorkspace.shared.activateFileViewerSelecting([url])
default: default:
guard let textEditURL = NSWorkspace.shared.urlForApplication(withBundleIdentifier: "com.apple.TextEdit") else { return } guard let textEditURL = NSWorkspace.shared.urlForApplication(withBundleIdentifier: "com.apple.TextEdit") else { return }

View File

@ -197,7 +197,7 @@ extension CtlPrefWindow: NSTextViewDelegate, NSTextFieldDelegate {
@IBAction func openExternallyPEButtonClicked(_: NSButton) { @IBAction func openExternallyPEButtonClicked(_: NSButton) {
DispatchQueue.main.async { [weak self] in DispatchQueue.main.async { [weak self] in
guard let self = self else { return } guard let self = self else { return }
let app: String = NSEvent.keyModifierFlags.contains(.option) ? "TextEdit" : "Finder" let app: String = NSEvent.keyModifierFlags.contains(.option) ? "com.apple.TextEdit" : "com.apple.finder"
LMMgr.shared.openPhraseFile(mode: self.selInputMode, type: self.selUserDataType, appIdentifier: app) LMMgr.shared.openPhraseFile(mode: self.selInputMode, type: self.selUserDataType, appIdentifier: app)
} }
} }