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:
		| @@ -64,12 +64,13 @@ public class BackupGUI implements ActionListener { | ||||
|      * @param progressPercent <p>The new percent of the progress bar</p> | ||||
|      */ | ||||
|     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); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Destroys the backup GUI | ||||
|   | ||||
| @@ -114,11 +114,20 @@ public class BackupUtil { | ||||
|         } | ||||
|  | ||||
|         gui.setStatus("Backup running..."); | ||||
|  | ||||
|         List<List<File>> 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); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user