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 14faab468..92333d1d3 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 @@ -1,6 +1,5 @@ package io.legado.app.help.storage -import androidx.appcompat.app.AppCompatActivity import io.legado.app.App import io.legado.app.R import io.legado.app.help.FileHelp @@ -27,21 +26,21 @@ object Backup { backupRssSource(path) backupReplaceRule(path) backupPreference(path) - WebDavHelp.backUpWebDav() + WebDavHelp.backUpWebDav(path) uiThread { App.INSTANCE.toast(R.string.backup_success) } } } - fun autoBackup(activity: AppCompatActivity) { + fun autoBackup() { doAsync { - val path = defaultPath + val path = defaultPath + File.separator + "autoBackup" backupBookshelf(path) backupBookSource(path) backupRssSource(path) backupReplaceRule(path) - WebDavHelp.backUpWebDav() + WebDavHelp.backUpWebDav(path) } } diff --git a/app/src/main/java/io/legado/app/help/storage/WebDavHelp.kt b/app/src/main/java/io/legado/app/help/storage/WebDavHelp.kt index d99141606..8c624a7e8 100644 --- a/app/src/main/java/io/legado/app/help/storage/WebDavHelp.kt +++ b/app/src/main/java/io/legado/app/help/storage/WebDavHelp.kt @@ -78,13 +78,13 @@ object WebDavHelp { } } - fun backUpWebDav() { + fun backUpWebDav(path: String) { if (initWebDav()) { val paths = arrayListOf() - paths.add(Backup.defaultPath + File.separator + "bookshelf.json") - paths.add(Backup.defaultPath + File.separator + "bookSource.json") - paths.add(Backup.defaultPath + File.separator + "rssSource.json") - paths.add(Backup.defaultPath + File.separator + "replaceRule.json") + paths.add(path + File.separator + "bookshelf.json") + paths.add(path + File.separator + "bookSource.json") + paths.add(path + File.separator + "rssSource.json") + paths.add(path + File.separator + "replaceRule.json") FileHelp.deleteFile(zipFilePath) if (ZipUtils.zipFiles(paths, zipFilePath)) { WebDav(getWebDavUrl() + "legado").makeAsDir()