mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 10:44:42 +00:00
fix(LocalSource): Updating local entry crashes the app
This commit is contained in:
parent
85c30027cc
commit
2393ddf9ce
1 changed files with 2 additions and 2 deletions
|
@ -58,7 +58,7 @@ class LocalSource(private val context: Context) : CatalogueSource, UnmeteredSour
|
|||
val dir = getBaseDirectory()
|
||||
var cover = getCoverFile(dir.findFile(manga.url))
|
||||
if (cover == null) {
|
||||
cover = dir.findFile(manga.url)?.findFile(COVER_NAME)!!
|
||||
cover = dir.findFile(manga.url)?.createFile(COVER_NAME)!!
|
||||
}
|
||||
// It might not exist if using the external SD card
|
||||
cover.parentFile?.parentFile?.createDirectory(cover.parentFile?.name)
|
||||
|
@ -204,7 +204,7 @@ class LocalSource(private val context: Context) : CatalogueSource, UnmeteredSour
|
|||
lang?.let { langMap[manga.url] = it }
|
||||
val json = Json { prettyPrint = true }
|
||||
val existingFileName = directory.listFiles()?.find { it.extension.equals("json", ignoreCase = true) }?.name
|
||||
val file = directory.findFile(existingFileName ?: "info.json")!!
|
||||
val file = directory.createFile(existingFileName ?: "info.json")!!
|
||||
file.writeText(json.encodeToString(manga.toJson(lang)))
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue