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