Call the backup cleaner method

This commit is contained in:
Marc Baloup 2022-12-12 19:41:53 +01:00
parent 264300ead6
commit f2d1acd24a
Signed by: marcbal
GPG Key ID: BBC0FE3ABC30B893
2 changed files with 13 additions and 0 deletions

View File

@ -104,6 +104,12 @@ public abstract class CompressProcess implements Comparable<CompressProcess>, Ru
backupManager.persist.updateDirtyStatusAfterCompress(type, name);
displayDirtynessStatus();
try {
type.backupCleaner(backupManager.config).cleanupArchives(targetDir);
} catch (Exception e) {
Log.severe(e);
}
}
catch (final Exception e) {
Log.severe("[Backup] Failed: " + sourceDir + " -> " + target, e);

View File

@ -15,5 +15,12 @@ public enum Type {
case WORKDIR -> cfg.workdirBackupEnabled;
};
}
public BackupCleaner backupCleaner(BackupConfig cfg) {
return switch (this) {
case WORLDS -> cfg.worldBackupCleaner;
case WORKDIR -> cfg.workdirBackupCleaner;
};
}
}