feat: 优化代码

pull/118/head
kunfei 5 years ago
parent 716b2f4caf
commit d86bd0117f
  1. 14
      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)
}
}
}

Loading…
Cancel
Save