diff --git a/app/src/main/java/io/legado/app/help/storage/Backup.kt b/app/src/main/java/io/legado/app/help/storage/Backup.kt index 85e7b23b6..8e28e0865 100644 --- a/app/src/main/java/io/legado/app/help/storage/Backup.kt +++ b/app/src/main/java/io/legado/app/help/storage/Backup.kt @@ -16,6 +16,7 @@ import kotlinx.coroutines.Dispatchers.IO import kotlinx.coroutines.withContext import splitties.init.appCtx import java.io.File +import java.io.FileOutputStream import java.util.concurrent.TimeUnit @@ -114,8 +115,10 @@ object Backup { private fun writeListToJson(list: List, fileName: String, path: String) { if (list.isNotEmpty()) { - val json = GSON.toJson(list) - FileUtils.createFileIfNotExist(path + File.separator + fileName).writeText(json) + val file = FileUtils.createFileIfNotExist(path + File.separator + fileName) + FileOutputStream(file).use { + GSON.writeToOutputStream(it, list) + } } }