public final class BackupUtils
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static boolean |
cleanUpBackups(java.io.File exportDir,
java.awt.Window parent)
Deletes backups, oldest first, until there is at least
Configuration .minimumFreeSpaceForMaps GB
free, and only if enabled and/or the user gives permission. |
static java.io.File |
getBackupFile(java.io.File file,
int backup)
Create a backup file by appending a number to the name part of the
filename.
|
public static java.io.File getBackupFile(java.io.File file, int backup)
file
- The file for which to create a backup file.backup
- The backup number to append.public static boolean cleanUpBackups(java.io.File exportDir, java.awt.Window parent) throws java.io.IOException
Configuration
.minimumFreeSpaceForMaps
GB
free, and only if enabled and/or the user gives permission. Because of that, even if this method returns
true
it is not guaranteed that there is at least minimumFreeSpaceForMaps
GB free.
If an exportDir
is specified, this is assumed to be an automatic cleanup. Only the file store on which
the worldDir
is located will be cleaned, and dialogs will only be shown to the user if a cleanup was
actually necessary.
If an {code exportDir} is not specified, this is assumed to be a manual request. The method will try to find all backup directories on all file stores and clean them if necessary, and will always give feedback to the user through dialogs, even if nothing was done.
exportDir
- The directory to which the world is being exported. May be null
.parent
- The parent window for notifications. May be null
.false
if the user indicated the operation should be cancelled, true
otherwise.java.io.IOException