mgrLM // Enforce UserPhraseLM format consolidation on write.

This commit is contained in:
ShikiSuen 2022-02-16 17:28:02 +08:00
parent aade60dd62
commit d8fab57402
1 changed files with 4 additions and 0 deletions

View File

@ -20,6 +20,7 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR TH
#import "mgrLangModel.h" #import "mgrLangModel.h"
#import "mgrLangModel_Privates.h" #import "mgrLangModel_Privates.h"
#import "vChewing-Swift.h" #import "vChewing-Swift.h"
#import "LMConsolidator.h"
using namespace std; using namespace std;
using namespace vChewing; using namespace vChewing;
@ -267,6 +268,9 @@ static void LTLoadLanguageModelFile(NSString *filenameWithoutExtension, vChewing
[writeFile writeData:data]; [writeFile writeData:data];
[writeFile closeFile]; [writeFile closeFile];
// We enforce the format consolidation here, since the pragma header will let the UserPhraseLM bypasses the consolidating process on load.
LMConsolidator::ConsolidateContent([path UTF8String], Preferences.shouldAutoSortUserPhrasesAndExclListOnLoad, false);
// We use FSEventStream to monitor the change of the user phrase folder, // We use FSEventStream to monitor the change of the user phrase folder,
// so we don't have to load data here. // so we don't have to load data here.
// [self loadUserPhrases]; // [self loadUserPhrases];