From 80aeb5d40045a4ddfba6563ca8284d1e26ea8547 Mon Sep 17 00:00:00 2001 From: kunfei Date: Sun, 15 Sep 2019 21:40:32 +0800 Subject: [PATCH] up --- .../main/java/io/legado/app/help/storage/Restore.kt | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/io/legado/app/help/storage/Restore.kt b/app/src/main/java/io/legado/app/help/storage/Restore.kt index 43437a46b..2caae0a40 100644 --- a/app/src/main/java/io/legado/app/help/storage/Restore.kt +++ b/app/src/main/java/io/legado/app/help/storage/Restore.kt @@ -81,10 +81,10 @@ object Restore { } fun importYueDuData(context: Context) { - val yuedu = File(FileUtils.getSdPath(), "YueDu") + val file = File(FileUtils.getSdPath(), "YueDu") // 导入书架 - val shelfFile = File(yuedu, "myBookShelf.json") + val shelfFile = File(file, "myBookShelf.json") val books = mutableListOf() if (shelfFile.exists()) try { doAsync { @@ -130,16 +130,14 @@ object Restore { uiThread { context.toast(if (count > 0) "成功地导入 $count 本新书和音频" else "没有发现新书或音频") } - } - } catch (e: Exception) { Log.e(AppConst.APP_TAG, "Failed to import book shelf.", e) context.toast("Unable to import books:\n${e.localizedMessage}") } // Book source - val sourceFile = File(yuedu, "myBookSource.json") + val sourceFile = File(file, "myBookSource.json") val bookSources = mutableListOf() if (sourceFile.exists()) try { doAsync { @@ -156,9 +154,8 @@ object Restore { e.printStackTrace() } - // Replace rules - val ruleFile = File(yuedu, "myBookReplaceRule.json") + val ruleFile = File(file, "myBookReplaceRule.json") val replaceRules = mutableListOf() if (ruleFile.exists()) try { doAsync { @@ -184,7 +181,6 @@ object Restore { context.toast(if (count > 0) "成功地导入 $count 条净化替换规则" else "没有发现新的净化替换规则") } } - } catch (e: Exception) { Log.e(AppConst.APP_TAG, e.localizedMessage) }