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 c7de266ca..4076c96a7 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,12 +100,16 @@ object Backup { for (fileName in backupFileNames) { val file = File(backupPath + File.separator + fileName) if (file.exists()) { - val doc = treeDoc.findFile(fileName) ?: treeDoc.createFile("", fileName) + var doc = treeDoc.findFile(fileName) + if (null != doc && doc.exists()) { + doc.delete() + } + doc = treeDoc.createFile("", fileName) doc?.let { DocumentUtils.writeText( context, file.readText(), - doc.uri + it.uri ) } }