mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-19 22:29:15 +01:00
rewrite getFormat the kotlin way (#5930)
This commit is contained in:
parent
fce3cd00a1
commit
3664195c71
@ -272,17 +272,17 @@ class LocalSource(private val context: Context) : CatalogueSource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun getFormat(file: File): Format {
|
private fun getFormat(file: File): Format {
|
||||||
val extension = file.extension
|
return file.run {
|
||||||
return if (file.isDirectory) {
|
when {
|
||||||
Format.Directory(file)
|
isDirectory -> Format.Directory(file)
|
||||||
} else if (extension.equals("zip", true) || extension.equals("cbz", true)) {
|
extension.equals("zip", true) -> Format.Zip(file)
|
||||||
Format.Zip(file)
|
extension.equals("cbz", true) -> Format.Zip(file)
|
||||||
} else if (extension.equals("rar", true) || extension.equals("cbr", true)) {
|
extension.equals("rar", true) -> Format.Rar(file)
|
||||||
Format.Rar(file)
|
extension.equals("cbr", true) -> Format.Rar(file)
|
||||||
} else if (extension.equals("epub", true)) {
|
extension.equals("epub", true) -> Format.Epub(file)
|
||||||
Format.Epub(file)
|
|
||||||
} else {
|
else -> throw Exception("Invalid chapter format")
|
||||||
throw Exception(context.getString(R.string.local_invalid_format))
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user