mirror of
https://github.com/mihonapp/mihon.git
synced 2025-06-25 18:47:51 +02:00
@ -310,8 +310,10 @@ actual class LocalSource(
|
||||
|
||||
fun getFormat(chapter: SChapter): Format {
|
||||
try {
|
||||
val (mangaDirName, chapterName) = chapter.url.split(File.separator, limit = 2)
|
||||
return fileSystem.getBaseDirectory()
|
||||
?.findFile(chapter.url)
|
||||
?.findFile(mangaDirName)
|
||||
?.findFile(chapterName)
|
||||
?.let(Format.Companion::valueOf)
|
||||
?: throw Exception(context.stringResource(MR.strings.chapter_not_found))
|
||||
} catch (e: Format.UnknownFormatException) {
|
||||
|
@ -1,18 +1,14 @@
|
||||
package tachiyomi.source.local.io
|
||||
|
||||
import android.content.Context
|
||||
import androidx.core.net.toUri
|
||||
import com.hippo.unifile.UniFile
|
||||
import tachiyomi.core.storage.FolderProvider
|
||||
import tachiyomi.domain.storage.service.StorageManager
|
||||
|
||||
actual class LocalSourceFileSystem(
|
||||
private val context: Context,
|
||||
private val folderProvider: FolderProvider,
|
||||
private val storageManager: StorageManager,
|
||||
) {
|
||||
|
||||
actual fun getBaseDirectory(): UniFile? {
|
||||
return UniFile.fromUri(context, folderProvider.path().toUri())
|
||||
?.createDirectory("local")
|
||||
return storageManager.getLocalSourceDirectory()
|
||||
}
|
||||
|
||||
actual fun getFilesInBaseDirectory(): List<UniFile> {
|
||||
|
Reference in New Issue
Block a user