mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 10:44:42 +00:00
refactor(source/local): Re-organize updateCover(...)
This commit is contained in:
parent
49ecfc51b1
commit
448a582019
1 changed files with 6 additions and 4 deletions
|
@ -73,11 +73,13 @@ class LocalSource(private val context: Context) : CatalogueSource, UnmeteredSour
|
||||||
}
|
}
|
||||||
|
|
||||||
fun updateCover(manga: SManga, input: InputStream): UniFile? {
|
fun updateCover(manga: SManga, input: InputStream): UniFile? {
|
||||||
val dir = getBaseDirectory() ?: return null
|
val dir = getBaseDirectory()?.findFile(manga.url)
|
||||||
var cover = getCoverFile(dir.findFile(manga.url))
|
if (dir == null) {
|
||||||
if (cover == null) {
|
input.close()
|
||||||
cover = dir.findFile(manga.url)?.createFile(COVER_NAME)!!
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val cover = getCoverFile(dir) ?: dir.createFile(COVER_NAME)!!
|
||||||
// It might not exist if using the external SD card
|
// It might not exist if using the external SD card
|
||||||
cover.parentFile?.parentFile?.createDirectory(cover.parentFile?.name)
|
cover.parentFile?.parentFile?.createDirectory(cover.parentFile?.name)
|
||||||
input.use {
|
input.use {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue