mgrLM // Handle cases of missing EOF on writing user phrases.
- We always add std::endl prior to new phrase insertion. Reason: the upstream approach of detecting the existence of EOF seems not usable in Swift 5.
This commit is contained in:
parent
b8c491cef6
commit
11e5c42ec7
|
@ -403,13 +403,15 @@ class mgrLangModel: NSObject {
|
|||
// module shipped in the vChewing Phrase Editor.
|
||||
currentMarkedPhrase += "\t#𝙾𝚟𝚎𝚛𝚛𝚒𝚍𝚎"
|
||||
}
|
||||
currentMarkedPhrase += "\n"
|
||||
|
||||
if let writeFile = FileHandle(forUpdatingAtPath: path),
|
||||
let data = currentMarkedPhrase.data(using: .utf8)
|
||||
let data = currentMarkedPhrase.data(using: .utf8),
|
||||
let endl = "\n".data(using: .utf8)
|
||||
{
|
||||
writeFile.seekToEndOfFile()
|
||||
writeFile.write(endl)
|
||||
writeFile.write(data)
|
||||
writeFile.write(endl)
|
||||
writeFile.closeFile()
|
||||
} else {
|
||||
return false
|
||||
|
|
Loading…
Reference in New Issue