From c8040a4278507b532de6688d45aeafb2a520b214 Mon Sep 17 00:00:00 2001 From: kunfei Date: Tue, 15 Oct 2019 16:07:13 +0800 Subject: [PATCH] up --- app/src/main/java/io/legado/app/help/ReadBookConfig.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/io/legado/app/help/ReadBookConfig.kt b/app/src/main/java/io/legado/app/help/ReadBookConfig.kt index 8c7d4ae18..328433c3c 100644 --- a/app/src/main/java/io/legado/app/help/ReadBookConfig.kt +++ b/app/src/main/java/io/legado/app/help/ReadBookConfig.kt @@ -20,6 +20,8 @@ import java.io.IOException */ object ReadBookConfig { const val readConfigFileName = "readConfig.json" + private val configFilePath = + App.INSTANCE.filesDir.absolutePath + File.separator + readConfigFileName val configList: ArrayList = arrayListOf() var styleSelect @@ -40,8 +42,7 @@ object ReadBookConfig { } fun upConfig() { - val configFile = - File(App.INSTANCE.filesDir.absolutePath + File.separator + readConfigFileName) + val configFile = File(configFilePath) val json = if (configFile.exists()) { configFile.readText() } else { @@ -68,8 +69,7 @@ object ReadBookConfig { fun save() { GlobalScope.launch(IO) { val json = GSON.toJson(configList) - val configFile = - File(App.INSTANCE.filesDir.absolutePath + File.separator + readConfigFileName) + val configFile = File(configFilePath) //获取流并存储 try { BufferedWriter(FileWriter(configFile)).use { writer ->