From d86bd0117f4be7cfafbaa442691c8f8b682bc55c Mon Sep 17 00:00:00 2001 From: kunfei Date: Wed, 26 Feb 2020 08:30:56 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/io/legado/app/help/storage/Backup.kt | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) 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 4076c96a7..1e3c77489 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 @@ -100,17 +100,9 @@ object Backup { for (fileName in backupFileNames) { val file = File(backupPath + File.separator + fileName) if (file.exists()) { - var doc = treeDoc.findFile(fileName) - if (null != doc && doc.exists()) { - doc.delete() - } - doc = treeDoc.createFile("", fileName) - doc?.let { - DocumentUtils.writeText( - context, - file.readText(), - it.uri - ) + treeDoc.findFile(fileName)?.delete() + treeDoc.createFile("", fileName)?.let { + DocumentUtils.writeText(context, file.readText(), it.uri) } } }