mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-21 20:47:03 -05:00
Ignore casing when looking for some files/folders
This commit is contained in:
parent
a74a689c90
commit
e41668862f
4 changed files with 4 additions and 5 deletions
|
@ -27,7 +27,6 @@ import androidx.compose.runtime.rememberCoroutineScope
|
|||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.core.net.toUri
|
||||
import cafe.adriel.voyager.navigator.LocalNavigator
|
||||
import cafe.adriel.voyager.navigator.currentOrThrow
|
||||
|
|
|
@ -91,7 +91,7 @@ class DownloadProvider(
|
|||
val mangaDir = findMangaDir(manga.title, source) ?: return null to emptyList()
|
||||
return mangaDir to chapters.mapNotNull { chapter ->
|
||||
getValidChapterDirNames(chapter.name, chapter.scanlator).asSequence()
|
||||
.mapNotNull { mangaDir.findFile(it) }
|
||||
.mapNotNull { mangaDir.findFile(it, true) }
|
||||
.firstOrNull()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -642,7 +642,7 @@ class Downloader(
|
|||
val categories = getCategories.await(manga.id).map { it.name.trim() }.takeUnless { it.isEmpty() }
|
||||
val comicInfo = getComicInfo(manga, chapter, chapterUrl, categories)
|
||||
// Remove the old file
|
||||
dir.findFile(COMIC_INFO_FILE)?.delete()
|
||||
dir.findFile(COMIC_INFO_FILE, true)?.delete()
|
||||
dir.createFile(COMIC_INFO_FILE)!!.openOutputStream().use {
|
||||
val comicInfoString = xml.encodeToString(ComicInfo.serializer(), comicInfo)
|
||||
it.write(comicInfoString.toByteArray())
|
||||
|
|
|
@ -303,8 +303,8 @@ actual class LocalSource(
|
|||
try {
|
||||
val (mangaDirName, chapterName) = chapter.url.split('/', limit = 2)
|
||||
return fileSystem.getBaseDirectory()
|
||||
?.findFile(mangaDirName)
|
||||
?.findFile(chapterName)
|
||||
?.findFile(mangaDirName, true)
|
||||
?.findFile(chapterName, true)
|
||||
?.let(Format.Companion::valueOf)
|
||||
?: throw Exception(context.stringResource(MR.strings.chapter_not_found))
|
||||
} catch (e: Format.UnknownFormatException) {
|
||||
|
|
Loading…
Reference in a new issue