Old backups now will be deleted after being restored
parent
3d4867519c
commit
9877fe5c2c
|
@ -54,6 +54,9 @@ public class ConfigHandler {
|
||||||
"Be very careful when setting it, as it is easy corrupt your world!\n")
|
"Be very careful when setting it, as it is easy corrupt your world!\n")
|
||||||
public Set<String> fileBlacklist = new HashSet<>();
|
public Set<String> fileBlacklist = new HashSet<>();
|
||||||
|
|
||||||
|
@Comment("\nShould backups be deleted after being restored?\n")
|
||||||
|
public boolean deleteOldBackupAfterRestore = true;
|
||||||
|
|
||||||
@Comment("\nMaximum number of backups to keep. If set to 0 then no backup will be deleted based their amount\n")
|
@Comment("\nMaximum number of backups to keep. If set to 0 then no backup will be deleted based their amount\n")
|
||||||
public int backupsToKeep = 10;
|
public int backupsToKeep = 10;
|
||||||
|
|
||||||
|
|
|
@ -74,6 +74,13 @@ public class RestoreBackupRunnable implements Runnable {
|
||||||
GenericTarDecompressor.decompress(backupFile, worldFile);
|
GenericTarDecompressor.decompress(backupFile, worldFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(Statics.CONFIG.deleteOldBackupAfterRestore) {
|
||||||
|
Statics.LOGGER.info("Deleting old backup");
|
||||||
|
|
||||||
|
if(!backupFile.delete())
|
||||||
|
Statics.LOGGER.info("Something went wrong while deleting old backup");
|
||||||
|
}
|
||||||
|
|
||||||
Statics.LOGGER.info("Done!");
|
Statics.LOGGER.info("Done!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue