Massively improve findFile performance (#728)
* Massively improve findFile performance * Update libs.versions.toml --------- Co-authored-by: AntsyLich <59261191+AntsyLich@users.noreply.github.com> (cherry picked from commit 7ec2108812fbe0483111dbe996e29e5a621b583a)
This commit is contained in:
committed by
Jobobby04
parent
712cd1493f
commit
089e6268e7
@@ -368,8 +368,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) {
|
||||
|
||||
+2
-2
@@ -17,13 +17,13 @@ actual class LocalSourceFileSystem(
|
||||
|
||||
actual fun getMangaDirectory(name: String): UniFile? {
|
||||
return getBaseDirectory()
|
||||
?.findFile(name, true)
|
||||
?.findFile(name)
|
||||
?.takeIf { it.isDirectory }
|
||||
}
|
||||
|
||||
actual fun getFilesInMangaDirectory(name: String): List<UniFile> {
|
||||
return getBaseDirectory()
|
||||
?.findFile(name, true)
|
||||
?.findFile(name)
|
||||
?.takeIf { it.isDirectory }
|
||||
?.listFiles().orEmpty().toList()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user