修复低版本手机打开本地文件出错的bug

pull/1500/head
gedoor 3 years ago
parent 707ead85d8
commit 609619412a
  1. 6
      app/src/main/java/io/legado/app/model/localBook/LocalBook.kt

@ -35,7 +35,11 @@ object LocalBook {
if (uri.isContentScheme()) { if (uri.isContentScheme()) {
return appCtx.contentResolver.openInputStream(uri)!! return appCtx.contentResolver.openInputStream(uri)!!
} }
return FileInputStream(File(uri.path!!)) val file = File(uri.path!!)
if (file.exists()) {
return FileInputStream(File(uri.path!!))
}
throw FileNotFoundException("${uri.path} 文件不存在")
} }
@Throws(Exception::class) @Throws(Exception::class)

Loading…
Cancel
Save