|
|
@ -100,12 +100,16 @@ object Backup { |
|
|
|
for (fileName in backupFileNames) { |
|
|
|
for (fileName in backupFileNames) { |
|
|
|
val file = File(backupPath + File.separator + fileName) |
|
|
|
val file = File(backupPath + File.separator + fileName) |
|
|
|
if (file.exists()) { |
|
|
|
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 { |
|
|
|
doc?.let { |
|
|
|
DocumentUtils.writeText( |
|
|
|
DocumentUtils.writeText( |
|
|
|
context, |
|
|
|
context, |
|
|
|
file.readText(), |
|
|
|
file.readText(), |
|
|
|
doc.uri |
|
|
|
it.uri |
|
|
|
) |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|