don't create empty snapshots

This commit is contained in:
Torsten Grote 2024-07-03 12:03:07 -03:00
parent 431e5ba8f5
commit 777aa6d525
No known key found for this signature in database
GPG key ID: 3E5F77D92CF891FF

View file

@ -33,6 +33,8 @@ internal class BackupResult(
backupMediaFiles = backupMediaFiles + other.backupMediaFiles,
backupDocumentFiles = backupDocumentFiles + other.backupDocumentFiles,
)
val isEmpty: Boolean = backupMediaFiles.isEmpty() && backupDocumentFiles.isEmpty()
}
internal class Backup(
@ -134,6 +136,7 @@ internal class Backup(
fileBackup.backupFiles(filesResult.files, availableChunkIds, backupObserver)
}
val result = largeResult + smallResult
if (result.isEmpty) return // TODO maybe warn user that nothing could get backed up?
val backupSize = result.backupMediaFiles.sumOf { it.size } +
result.backupDocumentFiles.sumOf { it.size }
val endTime = System.currentTimeMillis()