Fix local source update manga info

This commit is contained in:
Jobobby04 2023-12-30 18:46:25 -05:00
parent acd0ca99ed
commit 55115d2eb6

View File

@ -154,11 +154,10 @@ actual class LocalSource(
// SY -->
fun updateMangaInfo(manga: SManga) {
val directory = fileSystem.getFilesInBaseDirectory().map { it.createDirectory(manga.url) }.find {
it?.exists() == true
} ?: return
val existingFile = directory.listFiles()?.find { it.extension == "json" }
val file = existingFile ?: directory.createFile("info.json") ?: return
val existingFile = fileSystem.getFilesInMangaDirectory(manga.url).find { it.extension == "json" }
val file = existingFile
?: fileSystem.getMangaDirectory(manga.url)?.createFile("info.json")
?: return
file.openOutputStream().use {
json.encodeToStream(manga.toJson(), it)
}