Fix local source update manga info
This commit is contained in:
parent
acd0ca99ed
commit
55115d2eb6
@ -154,11 +154,10 @@ actual class LocalSource(
|
|||||||
|
|
||||||
// SY -->
|
// SY -->
|
||||||
fun updateMangaInfo(manga: SManga) {
|
fun updateMangaInfo(manga: SManga) {
|
||||||
val directory = fileSystem.getFilesInBaseDirectory().map { it.createDirectory(manga.url) }.find {
|
val existingFile = fileSystem.getFilesInMangaDirectory(manga.url).find { it.extension == "json" }
|
||||||
it?.exists() == true
|
val file = existingFile
|
||||||
} ?: return
|
?: fileSystem.getMangaDirectory(manga.url)?.createFile("info.json")
|
||||||
val existingFile = directory.listFiles()?.find { it.extension == "json" }
|
?: return
|
||||||
val file = existingFile ?: directory.createFile("info.json") ?: return
|
|
||||||
file.openOutputStream().use {
|
file.openOutputStream().use {
|
||||||
json.encodeToStream(manga.toJson(), it)
|
json.encodeToStream(manga.toJson(), it)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user