mirror of
https://github.com/gedoor/legado.git
synced 2024-09-03 09:55:00 +08:00
优化
This commit is contained in:
parent
e527b7fb5d
commit
99582dfcd7
@ -173,7 +173,7 @@ interface JsExtensions : JsEncodeUtils {
|
||||
*/
|
||||
fun importScript(path: String): String {
|
||||
val result = when {
|
||||
path.startsWith("http") -> cacheFile(path) ?: ""
|
||||
path.startsWith("http") -> cacheFile(path)
|
||||
path.isUri() -> Uri.parse(path).readText(appCtx)
|
||||
path.startsWith("/storage") -> FileUtils.readText(path)
|
||||
else -> readTxtFile(path)
|
||||
@ -187,7 +187,7 @@ interface JsExtensions : JsEncodeUtils {
|
||||
* @param urlStr 网络文件的链接
|
||||
* @return 返回缓存后的文件内容
|
||||
*/
|
||||
fun cacheFile(urlStr: String): String? {
|
||||
fun cacheFile(urlStr: String): String {
|
||||
return cacheFile(urlStr, 0)
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,9 @@ class FileAssociationViewModel(application: Application) : BaseAssociationViewMo
|
||||
val fileDoc = FileDoc.fromUri(uri, false)
|
||||
fileName = fileDoc.name
|
||||
if (fileName.matches(AppPattern.archiveFileRegex)) {
|
||||
ArchiveUtils.deCompress(fileDoc).forEach {
|
||||
ArchiveUtils.deCompress(fileDoc, ArchiveUtils.TEMP_PATH) {
|
||||
it.matches(bookFileRegex)
|
||||
}.forEach {
|
||||
dispatch(FileDoc.fromFile(it))
|
||||
}
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user