Massively improve findFile performance (#728)

* Massively improve findFile performance

* Update libs.versions.toml

---------

Co-authored-by: AntsyLich <59261191+AntsyLich@users.noreply.github.com>
This commit is contained in:
Radon Rosborough
2024-05-04 09:40:41 -07:00
committed by GitHub
parent e55e5f6f64
commit 7ec2108812
5 changed files with 9 additions and 9 deletions

View File

@ -300,8 +300,8 @@ actual class LocalSource(
try {
val (mangaDirName, chapterName) = chapter.url.split('/', limit = 2)
return fileSystem.getBaseDirectory()
?.findFile(mangaDirName, true)
?.findFile(chapterName, true)
?.findFile(mangaDirName)
?.findFile(chapterName)
?.let(Format.Companion::valueOf)
?: throw Exception(context.stringResource(MR.strings.chapter_not_found))
} catch (e: Format.UnknownFormatException) {

View File

@ -17,7 +17,7 @@ actual class LocalSourceFileSystem(
actual fun getMangaDirectory(name: String): UniFile? {
return getBaseDirectory()
?.findFile(name, true)
?.findFile(name)
?.takeIf { it.isDirectory }
}