fix internal dictionaty file names

resulted in assets dicts being extracted on every app start
This commit is contained in:
Helium314 2025-05-25 16:52:56 +02:00
parent deec4d1f98
commit 7da068145f
2 changed files with 2 additions and 2 deletions

View file

@ -32,7 +32,7 @@ object DictionaryFactory {
checkAndAddDictionaryToListNewType(it, dictList, locale)
}
nonExtracted.forEach { filename ->
val type = filename.substringBefore(".")
val type = filename.substringBefore("_")
if (dictList.any { it.mDictType == type }) return@forEach
val extractedFile = DictionaryInfoUtils.extractAssetsDictionary(filename, locale, context)
checkAndAddDictionaryToListNewType(extractedFile, dictList, locale)

View file

@ -136,7 +136,7 @@ object DictionaryInfoUtils {
}
fun extractAssetsDictionary(dictionaryFileName: String, locale: Locale, context: Context): File {
val targetFile = File(getCacheDirectoryForLocale(locale, context), "$dictionaryFileName.dict")
val targetFile = File(getCacheDirectoryForLocale(locale, context), "${dictionaryFileName.substringBefore("_")}.dict")
FileUtils.copyStreamToNewFile(
context.assets.open(ASSETS_DICTIONARY_FOLDER + File.separator + dictionaryFileName),
targetFile