Changed backup root path to Documents
This commit is contained in:
parent
484d003a3b
commit
348dc08f73
1 changed files with 11 additions and 10 deletions
|
@ -14,7 +14,6 @@ import java.util.zip.ZipOutputStream
|
||||||
|
|
||||||
object BackupHelper {
|
object BackupHelper {
|
||||||
suspend fun createBackup(context: Context, name: String) {
|
suspend fun createBackup(context: Context, name: String) {
|
||||||
withContext(Dispatchers.IO) {
|
|
||||||
val backupFile =
|
val backupFile =
|
||||||
File(backupRootPath + name + APPEND_EXTENSION)
|
File(backupRootPath + name + APPEND_EXTENSION)
|
||||||
if (backupFile.parentFile?.exists() != true) {
|
if (backupFile.parentFile?.exists() != true) {
|
||||||
|
@ -24,6 +23,7 @@ object BackupHelper {
|
||||||
zipItems.addAll(getDatabaseZipItems(context))
|
zipItems.addAll(getDatabaseZipItems(context))
|
||||||
zipItems.addAll(getSettingsZipItems(context))
|
zipItems.addAll(getSettingsZipItems(context))
|
||||||
getUserImageZipItems(context)?.let { zipItems.addAll(it) }
|
getUserImageZipItems(context)?.let { zipItems.addAll(it) }
|
||||||
|
withContext(Dispatchers.IO) {
|
||||||
zipAll(zipItems, backupFile)
|
zipAll(zipItems, backupFile)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -130,7 +130,8 @@ object BackupHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
val backupRootPath =
|
val backupRootPath =
|
||||||
Environment.getExternalStorageDirectory().toString() + "/RetroMusic/Backups/"
|
Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOCUMENTS)
|
||||||
|
.toString() + "/RetroMusic/Backups/"
|
||||||
const val BACKUP_EXTENSION = "rmbak"
|
const val BACKUP_EXTENSION = "rmbak"
|
||||||
const val APPEND_EXTENSION = ".$BACKUP_EXTENSION"
|
const val APPEND_EXTENSION = ".$BACKUP_EXTENSION"
|
||||||
private const val DATABASES_PATH = "databases"
|
private const val DATABASES_PATH = "databases"
|
||||||
|
|
Loading…
Reference in a new issue