mgrLM // Use Swiftified LMConsolidator instead.
This commit is contained in:
parent
309c6f04d1
commit
d06a39572e
|
@ -33,8 +33,8 @@ extension vChewing {
|
|||
let fileHandle = FileHandle(forReadingAtPath: path)!
|
||||
do {
|
||||
let lineReader = try LineReader(file: fileHandle)
|
||||
IME.prtDebugIntel("Header Seen ||\(lineReader)")
|
||||
for strLine in lineReader { // 不需要 i=0,因為第一遍迴圈就出結果。
|
||||
IME.prtDebugIntel("Header Seen ||\(strLine)")
|
||||
if strLine != kPragmaHeader {
|
||||
IME.prtDebugIntel("Header Mismatch, Starting In-Place Consolidation.")
|
||||
return false
|
||||
|
@ -68,7 +68,7 @@ extension vChewing {
|
|||
IME.prtDebugIntel("EOF Fix Failed w/ Error: \(error).")
|
||||
return false
|
||||
}
|
||||
IME.prtDebugIntel("Either EOF Fix Successful Or No-Need-To-Fix.")
|
||||
IME.prtDebugIntel("EOF Successfully Ensured (with possible autofixes performed).")
|
||||
return true
|
||||
}
|
||||
IME.prtDebugIntel("EOF Fix Failed: File Missing at \(path).")
|
||||
|
|
|
@ -39,7 +39,6 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
+ (BOOL)checkIfUserPhraseExist:(NSString *)userPhrase
|
||||
inputMode:(InputMode)mode
|
||||
key:(NSString *)key NS_SWIFT_NAME(checkIfUserPhraseExist(userPhrase:mode:key:));
|
||||
+ (void)consolidateGivenFile:(NSString *)path shouldCheckPragma:(BOOL)shouldCheckPragma;
|
||||
+ (void)setPhraseReplacementEnabled:(BOOL)phraseReplacementEnabled;
|
||||
+ (void)setCNSEnabled:(BOOL)cnsEnabled;
|
||||
+ (void)setSymbolEnabled:(BOOL)symbolEnabled;
|
||||
|
|
|
@ -141,12 +141,6 @@ static void LTLoadLanguageModelFile(NSString *filenameWithoutExtension, vChewing
|
|||
return NO;
|
||||
}
|
||||
|
||||
// 這個函數無法遷移至 Swift
|
||||
+ (void)consolidateGivenFile:(NSString *)path shouldCheckPragma:(BOOL)shouldCheckPragma
|
||||
{
|
||||
vChewing::LMConsolidator::ConsolidateContent([path UTF8String], shouldCheckPragma);
|
||||
}
|
||||
|
||||
// 這個函數無法遷移至 Swift
|
||||
+ (vChewing::LMInstantiator *)lmCHT
|
||||
{
|
||||
|
|
|
@ -233,7 +233,9 @@ import Cocoa
|
|||
|
||||
// We enforce the format consolidation here, since the pragma header
|
||||
// will let the UserPhraseLM bypasses the consolidating process on load.
|
||||
consolidate(givenFile: path, shouldCheckPragma: false)
|
||||
if !vChewing.LMConsolidator.consolidate(path: path, pragma: false) {
|
||||
return false
|
||||
}
|
||||
|
||||
// We use FSEventStream to monitor possible changes of the user phrase folder, hence the
|
||||
// lack of the needs of manually load data here unless FSEventStream is disabled by user.
|
||||
|
|
Loading…
Reference in New Issue