diff --git a/src/main/java/net/knarcraft/minecraftserverlauncher/userinterface/BackupGUI.java b/src/main/java/net/knarcraft/minecraftserverlauncher/userinterface/BackupGUI.java index e325836..8a9b537 100644 --- a/src/main/java/net/knarcraft/minecraftserverlauncher/userinterface/BackupGUI.java +++ b/src/main/java/net/knarcraft/minecraftserverlauncher/userinterface/BackupGUI.java @@ -64,11 +64,12 @@ public class BackupGUI implements ActionListener { * @param progressPercent

The new percent of the progress bar

*/ public static void updateProgress(String infoText, int progressPercent) { - if (progressTextArea == null || progressBar == null) { - return; + if (progressTextArea != null) { + progressTextArea.setText(infoText); + } + if (progressBar != null) { + progressBar.setValue(progressPercent); } - progressTextArea.setText(infoText); - progressBar.setValue(progressPercent); } /** diff --git a/src/main/java/net/knarcraft/minecraftserverlauncher/utility/BackupUtil.java b/src/main/java/net/knarcraft/minecraftserverlauncher/utility/BackupUtil.java index cfd5e0c..47034a6 100644 --- a/src/main/java/net/knarcraft/minecraftserverlauncher/utility/BackupUtil.java +++ b/src/main/java/net/knarcraft/minecraftserverlauncher/utility/BackupUtil.java @@ -114,11 +114,20 @@ public class BackupUtil { } gui.setStatus("Backup running..."); - List> serverFolders = getFoldersOfEnabledServers(path); + gui.setStatus("Calculating backup size..."); 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"); performBackup(gui, serverFolders, backupFileSize);