diff options
author | Keuin <[email protected]> | 2021-02-15 18:13:44 +0800 |
---|---|---|
committer | Keuin <[email protected]> | 2021-02-15 18:13:44 +0800 |
commit | b171d46ce07a9ed9a426779fcff92dd1f56b3dd1 (patch) | |
tree | 3df106d0000c12a7749fd24e28d2fde69983ae39 /src/main/java/com/keuin/kbackupfabric/operation/backup/method | |
parent | 6d6f0b486ac42b6bd69ddb8862ee3af7b819f3a7 (diff) |
Minor bugfix: incremental backup without `backups` directory created will fail.
Diffstat (limited to 'src/main/java/com/keuin/kbackupfabric/operation/backup/method')
-rw-r--r-- | src/main/java/com/keuin/kbackupfabric/operation/backup/method/ConfiguredIncrementalBackupMethod.java | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/main/java/com/keuin/kbackupfabric/operation/backup/method/ConfiguredIncrementalBackupMethod.java b/src/main/java/com/keuin/kbackupfabric/operation/backup/method/ConfiguredIncrementalBackupMethod.java index 5fe532a..0c202e1 100644 --- a/src/main/java/com/keuin/kbackupfabric/operation/backup/method/ConfiguredIncrementalBackupMethod.java +++ b/src/main/java/com/keuin/kbackupfabric/operation/backup/method/ConfiguredIncrementalBackupMethod.java @@ -75,6 +75,13 @@ public class ConfiguredIncrementalBackupMethod implements ConfiguredBackupMethod // legacy index file // ObjectCollectionSerializer.toFile(collection, new File(backupIndexFileSaveDirectory, backupIndexFileName)); + // create directory + final File indexDirectoryFile = new File(backupIndexFileSaveDirectory); + if (indexDirectoryFile.isFile()) + throw new IOException("There is a file which has the same name with index directory"); + if (!indexDirectoryFile.isDirectory() && !indexDirectoryFile.mkdirs()) + throw new IOException("Backup index save directory does not exist and we failed to create it"); + // newer saved info (with metadata) File indexFile = new File(backupIndexFileSaveDirectory, backupIndexFileName); BackupFileNameEncoder.BackupBasicInformation info = IncrementalBackupFileNameEncoder.INSTANCE.decode(backupIndexFileName); @@ -82,9 +89,9 @@ public class ConfiguredIncrementalBackupMethod implements ConfiguredBackupMethod collection, info.customName, info.time.atZone(ZoneId.systemDefault()), - copyResult.getBytesTotal(), - copyResult.getBytesCopied(), - copyResult.getFilesCopied(), + copyResult.getTotalBytes(), + copyResult.getCopiedBytes(), + copyResult.getCopiedFiles(), copyResult.getTotalFiles() )); |