mgrLangModel // Fix wrong path assignments.

This commit is contained in:
ShikiSuen 2022-05-04 15:57:13 +08:00
parent 5d39a03d8d
commit fe3659011f
3 changed files with 26 additions and 4 deletions

View File

@ -98,6 +98,8 @@ extension vChewing {
if path.contains("vChewing/") {
lmCore.dump()
}
} else {
IME.prtDebugIntel("lmCore: File access failure: \(path)")
}
}
@ -109,6 +111,8 @@ extension vChewing {
if path.contains("vChewing/") {
lmCNS.dump()
}
} else {
IME.prtDebugIntel("lmCNS: File access failure: \(path)")
}
}
@ -120,6 +124,8 @@ extension vChewing {
if path.contains("vChewing/") {
lmMisc.dump()
}
} else {
IME.prtDebugIntel("lmMisc: File access failure: \(path)")
}
}
@ -131,53 +137,70 @@ extension vChewing {
if path.contains("vChewing/") {
lmSymbols.dump()
}
} else {
IME.prtDebugIntel("lmSymbols: File access failure: \(path)")
}
}
public func loadUserPhrases(path: String, filterPath: String) {
if FileManager.default.isReadableFile(atPath: path) {
lmUserPhrases.close()
lmUserPhrases.open(path)
IME.prtDebugIntel("lmUserPhrases: \(lmUserPhrases.count) entries of data loaded from: \(path)")
if path.contains("vChewing/") {
lmUserPhrases.dump()
}
} else {
IME.prtDebugIntel("lmUserPhrases: File access failure: \(path)")
}
if FileManager.default.isReadableFile(atPath: filterPath) {
lmFiltered.close()
lmFiltered.open(filterPath)
IME.prtDebugIntel("lmFiltered: \(lmFiltered.count) entries of data loaded from: \(path)")
if path.contains("vChewing/") {
lmFiltered.dump()
}
} else {
IME.prtDebugIntel("lmFiltered: File access failure: \(path)")
}
}
public func loadUserSymbolData(path: String) {
if FileManager.default.isReadableFile(atPath: path) {
lmUserSymbols.close()
lmUserSymbols.open(path)
IME.prtDebugIntel("lmUserSymbol: \(lmUserSymbols.count) entries of data loaded from: \(path)")
if path.contains("vChewing/") {
lmUserSymbols.dump()
}
} else {
IME.prtDebugIntel("lmUserSymbol: File access failure: \(path)")
}
}
public func loadUserAssociatedPhrases(path: String) {
if FileManager.default.isReadableFile(atPath: path) {
lmAssociates.close()
lmAssociates.open(path)
IME.prtDebugIntel("lmAssociates: \(lmAssociates.count) entries of data loaded from: \(path)")
if path.contains("vChewing/") {
lmAssociates.dump()
}
} else {
IME.prtDebugIntel("lmAssociates: File access failure: \(path)")
}
}
public func loadPhraseReplacementMap(path: String) {
if FileManager.default.isReadableFile(atPath: path) {
lmReplacements.close()
lmReplacements.open(path)
IME.prtDebugIntel("lmReplacements: \(lmReplacements.count) entries of data loaded from: \(path)")
if path.contains("vChewing/") {
lmReplacements.dump()
}
} else {
IME.prtDebugIntel("lmReplacements: File access failure: \(path)")
}
}

View File

@ -46,7 +46,6 @@ extension vChewing {
@discardableResult public mutating func open(_ path: String) -> Bool {
if isLoaded() {
IME.prtDebugIntel("Not loading this one due to isLoaded result of true: \(path)")
return false
}

View File

@ -151,7 +151,7 @@ class mgrLangModel: NSObject {
public static func loadUserPhrases() {
gLangModelCHT.loadUserPhrases(
path: userSymbolDataPath(InputMode.imeModeCHT),
path: userPhrasesDataPath(InputMode.imeModeCHT),
filterPath: excludedPhrasesDataPath(InputMode.imeModeCHT)
)
gLangModelCHS.loadUserPhrases(
@ -166,7 +166,7 @@ class mgrLangModel: NSObject {
gLangModelCHT.loadUserAssociatedPhrases(
path: mgrLangModel.userAssociatedPhrasesDataPath(InputMode.imeModeCHT)
)
gLangModelCHT.loadUserAssociatedPhrases(
gLangModelCHS.loadUserAssociatedPhrases(
path: mgrLangModel.userAssociatedPhrasesDataPath(InputMode.imeModeCHS)
)
}
@ -175,7 +175,7 @@ class mgrLangModel: NSObject {
gLangModelCHT.loadPhraseReplacementMap(
path: mgrLangModel.phraseReplacementDataPath(InputMode.imeModeCHT)
)
gLangModelCHT.loadPhraseReplacementMap(
gLangModelCHS.loadPhraseReplacementMap(
path: mgrLangModel.phraseReplacementDataPath(InputMode.imeModeCHS)
)
}