mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 10:44:42 +00:00
fix(CustomMangaManager): Making sure the file actually exists
This commit is contained in:
parent
8b3d35bc2a
commit
554c8a84f8
1 changed files with 2 additions and 3 deletions
|
@ -111,11 +111,10 @@ class CustomMangaManager(val context: Context) {
|
|||
}
|
||||
|
||||
private fun saveCustomInfo(onComplete: () -> Unit = {}) {
|
||||
var comicInfoEdits = externalDir?.findFile(COMIC_INFO_EDITS_FILE)
|
||||
val comicInfoEdits = externalDir?.createFile(COMIC_INFO_EDITS_FILE) ?: return
|
||||
|
||||
val edits = customMangaMap.values.map { it.toComicInfo() }
|
||||
if (edits.isNotEmpty()) {
|
||||
if (comicInfoEdits == null || !comicInfoEdits.exists()) comicInfoEdits = externalDir?.createFile(COMIC_INFO_EDITS_FILE)!!
|
||||
if (edits.isNotEmpty() && comicInfoEdits.exists()) {
|
||||
comicInfoEdits.writeText(xml.encodeToString(ComicList.serializer(), ComicList(edits)), onComplete = onComplete)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue