pull/433/head
gedoor 4 years ago
parent 4db4a67ad1
commit 91a332fbb9
  1. 10
      app/src/main/java/io/legado/app/help/storage/Restore.kt

@ -78,7 +78,7 @@ object Restore {
for (fileName in Backup.backupFileNames) { for (fileName in Backup.backupFileNames) {
if (doc.name == fileName) { if (doc.name == fileName) {
DocumentUtils.readText(context, doc.uri)?.let { DocumentUtils.readText(context, doc.uri)?.let {
FileUtils.createFileIfNotExist(Backup.backupPath + File.separator + fileName) FileUtils.createFileIfNotExist("${Backup.backupPath}${File.separator}$fileName")
.writeText(it) .writeText(it)
} }
} }
@ -91,7 +91,7 @@ object Restore {
FileUtils.getFile(file, fileName).let { FileUtils.getFile(file, fileName).let {
if (it.exists()) { if (it.exists()) {
it.copyTo( it.copyTo(
FileUtils.createFileIfNotExist(Backup.backupPath + File.separator + fileName), FileUtils.createFileIfNotExist("${Backup.backupPath}${File.separator}$fileName"),
true true
) )
} }
@ -156,7 +156,7 @@ object Restore {
withContext(IO) { withContext(IO) {
try { try {
val file = val file =
FileUtils.createFileIfNotExist(path + File.separator + ThemeConfig.configFileName) FileUtils.createFileIfNotExist("$path${File.separator}${ThemeConfig.configFileName}")
if (file.exists()) { if (file.exists()) {
FileUtils.deleteFile(ThemeConfig.configFilePath) FileUtils.deleteFile(ThemeConfig.configFilePath)
file.copyTo(File(ThemeConfig.configFilePath)) file.copyTo(File(ThemeConfig.configFilePath))
@ -168,7 +168,7 @@ object Restore {
if (!ignoreReadConfig) { if (!ignoreReadConfig) {
try { try {
val file = val file =
FileUtils.createFileIfNotExist(path + File.separator + ReadBookConfig.configFileName) FileUtils.createFileIfNotExist("$path${File.separator}${ReadBookConfig.configFileName}")
if (file.exists()) { if (file.exists()) {
FileUtils.deleteFile(ReadBookConfig.configFilePath) FileUtils.deleteFile(ReadBookConfig.configFilePath)
file.copyTo(File(ReadBookConfig.configFilePath)) file.copyTo(File(ReadBookConfig.configFilePath))
@ -179,7 +179,7 @@ object Restore {
} }
try { try {
val file = val file =
FileUtils.createFileIfNotExist(path + File.separator + ReadBookConfig.shareConfigFileName) FileUtils.createFileIfNotExist("$path${File.separator}${ReadBookConfig.shareConfigFileName}")
if (file.exists()) { if (file.exists()) {
FileUtils.deleteFile(ReadBookConfig.shareConfigFilePath) FileUtils.deleteFile(ReadBookConfig.shareConfigFilePath)
file.copyTo(File(ReadBookConfig.shareConfigFilePath)) file.copyTo(File(ReadBookConfig.shareConfigFilePath))

Loading…
Cancel
Save