优化
This commit is contained in:
@@ -411,6 +411,7 @@ object LocalBook {
|
|||||||
return saveBookFile(inputStream, fileName)
|
return saveBookFile(inputStream, fileName)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Throws(SecurityException::class)
|
||||||
fun saveBookFile(
|
fun saveBookFile(
|
||||||
inputStream: InputStream,
|
inputStream: InputStream,
|
||||||
fileName: String
|
fileName: String
|
||||||
@@ -431,12 +432,18 @@ object LocalBook {
|
|||||||
}
|
}
|
||||||
doc.uri
|
doc.uri
|
||||||
} else {
|
} else {
|
||||||
|
try {
|
||||||
val treeFile = File(treeUri.path!!)
|
val treeFile = File(treeUri.path!!)
|
||||||
val file = treeFile.getFile(fileName)
|
val file = treeFile.getFile(fileName)
|
||||||
FileOutputStream(file).use { oStream ->
|
FileOutputStream(file).use { oStream ->
|
||||||
it.copyTo(oStream)
|
it.copyTo(oStream)
|
||||||
}
|
}
|
||||||
Uri.fromFile(file)
|
Uri.fromFile(file)
|
||||||
|
} catch (e: FileNotFoundException) {
|
||||||
|
throw SecurityException("请重新设置书籍保存位置\nPermission Denial\n$e").apply {
|
||||||
|
addSuppressed(e)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user