From 170c7004b3d0c99045db74adba0cc94387ae8125 Mon Sep 17 00:00:00 2001 From: kunfei Date: Thu, 19 Sep 2019 17:09:02 +0800 Subject: [PATCH] up --- app/src/main/java/io/legado/app/help/storage/Backup.kt | 9 ++++----- .../main/java/io/legado/app/help/storage/WebDavHelp.kt | 10 +++++----- 2 files changed, 9 insertions(+), 10 deletions(-) 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()