mirror of
https://github.com/gedoor/legado.git
synced 2024-07-06 23:47:49 +08:00
修复低版本手机打开本地文件出错的bug
This commit is contained in:
parent
ecb2496cbf
commit
707ead85d8
@ -31,11 +31,11 @@ object LocalBook {
|
|||||||
|
|
||||||
@Throws(FileNotFoundException::class, SecurityException::class)
|
@Throws(FileNotFoundException::class, SecurityException::class)
|
||||||
fun getBookInputStream(book: Book): InputStream {
|
fun getBookInputStream(book: Book): InputStream {
|
||||||
if (book.bookUrl.isContentScheme()) {
|
val uri = Uri.parse(book.bookUrl)
|
||||||
val uri = Uri.parse(book.bookUrl)
|
if (uri.isContentScheme()) {
|
||||||
return appCtx.contentResolver.openInputStream(uri)!!
|
return appCtx.contentResolver.openInputStream(uri)!!
|
||||||
}
|
}
|
||||||
return FileInputStream(File(book.bookUrl))
|
return FileInputStream(File(uri.path!!))
|
||||||
}
|
}
|
||||||
|
|
||||||
@Throws(Exception::class)
|
@Throws(Exception::class)
|
||||||
|
Loading…
Reference in New Issue
Block a user