mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-06-09 08:07:42 +00:00
fix broken file handling in DictionaryGroup
This commit is contained in:
parent
e25300d832
commit
7bc74810b1
1 changed files with 2 additions and 1 deletions
|
@ -718,7 +718,7 @@ private class DictionaryGroup(
|
|||
// words cannot be (permanently) removed from some dictionaries, so we use a blacklist for "removing" words
|
||||
private val blacklistFile = context?.let {
|
||||
File(it.filesDir.absolutePath + File.separator + "blacklists" + File.separator + locale.toLanguageTag() + ".txt")
|
||||
.also { it.mkdirs() }
|
||||
.also { it.parentFile?.mkdirs() }
|
||||
}
|
||||
|
||||
private val blacklist = hashSetOf<String>().apply {
|
||||
|
@ -741,6 +741,7 @@ private class DictionaryGroup(
|
|||
scope.launch {
|
||||
synchronized(this) {
|
||||
try {
|
||||
if (blacklistFile.isDirectory) blacklistFile.delete()
|
||||
blacklistFile.appendText("$word\n")
|
||||
} catch (e: IOException) {
|
||||
Log.e(TAG, "Exception while trying to add word \"$word\" to blacklist ${blacklistFile.name}", e)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue