Adds some backup fixes
All checks were successful
KnarCraft/Minecraft-Server-Launcher/pipeline/head This commit looks good
All checks were successful
KnarCraft/Minecraft-Server-Launcher/pipeline/head This commit looks good
Fixes a potential NullPointerException Adds a check to make sure the backup location has enough available space Adds a message when calculating backup size to make it clear that the software is not frozen
This commit is contained in:
parent
71e47acbb0
commit
c26a3bc3b5
@ -64,11 +64,12 @@ public class BackupGUI implements ActionListener {
|
|||||||
* @param progressPercent <p>The new percent of the progress bar</p>
|
* @param progressPercent <p>The new percent of the progress bar</p>
|
||||||
*/
|
*/
|
||||||
public static void updateProgress(String infoText, int progressPercent) {
|
public static void updateProgress(String infoText, int progressPercent) {
|
||||||
if (progressTextArea == null || progressBar == null) {
|
if (progressTextArea != null) {
|
||||||
return;
|
progressTextArea.setText(infoText);
|
||||||
|
}
|
||||||
|
if (progressBar != null) {
|
||||||
|
progressBar.setValue(progressPercent);
|
||||||
}
|
}
|
||||||
progressTextArea.setText(infoText);
|
|
||||||
progressBar.setValue(progressPercent);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -114,11 +114,20 @@ public class BackupUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
gui.setStatus("Backup running...");
|
gui.setStatus("Backup running...");
|
||||||
|
|
||||||
List<List<File>> serverFolders = getFoldersOfEnabledServers(path);
|
List<List<File>> serverFolders = getFoldersOfEnabledServers(path);
|
||||||
|
|
||||||
|
gui.setStatus("Calculating backup size...");
|
||||||
long backupFileSize = getFolderSize(gui, serverFolders);
|
long backupFileSize = getFolderSize(gui, serverFolders);
|
||||||
|
|
||||||
|
long locationFreeSpace = path.getFreeSpace();
|
||||||
|
if (locationFreeSpace < (backupFileSize + 2048000000)) {
|
||||||
|
gui.setStatus("Not enough available space. " + (backupFileSize / 1000000) + "MB necessary, but only " +
|
||||||
|
(locationFreeSpace / 1000000) + "MB available");
|
||||||
|
backupRunning = false;
|
||||||
|
backupAborted = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
gui.setStatus("Backing up " + (backupFileSize / 1000000) + "MB");
|
gui.setStatus("Backing up " + (backupFileSize / 1000000) + "MB");
|
||||||
|
|
||||||
performBackup(gui, serverFolders, backupFileSize);
|
performBackup(gui, serverFolders, backupFileSize);
|
||||||
|
Loading…
Reference in New Issue
Block a user