Fixed synchroniser deleting source directory
This commit is contained in:
		
							
								
								
									
										5
									
								
								.woodpecker/package.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								.woodpecker/package.yml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,5 @@ | |||||||
|  | steps: | ||||||
|  |   - name: package | ||||||
|  |     image: maven:3.9.9-eclipse-temurin-21-alpine | ||||||
|  |     commands: | ||||||
|  |       - mvn package | ||||||
							
								
								
									
										5
									
								
								.woodpecker/test.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								.woodpecker/test.yml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,5 @@ | |||||||
|  | steps: | ||||||
|  |   - name: test | ||||||
|  |     image: maven:3.9.9-eclipse-temurin-21-alpine | ||||||
|  |     commands: | ||||||
|  |       - mvn test | ||||||
| @@ -15,16 +15,11 @@ public class ApacheCommonsIOSynchroniser implements Synchroniser { | |||||||
|             source = Path.of(root.getPath(), dest.getPath()).toFile(); |             source = Path.of(root.getPath(), dest.getPath()).toFile(); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         if (source.exists() && dest.exists()) { |  | ||||||
|             dest.delete(); |  | ||||||
|             // Fixes an issue where sometimes, Apache Commons IO will fail to overwrite. |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         if (source.isDirectory()) { |         if (source.isDirectory()) { | ||||||
|             if (dest.isDirectory()) { |             if (dest.isDirectory()) { | ||||||
|                 FileUtils.copyDirectory(source, dest); |                 FileUtils.copyDirectory(source, dest); | ||||||
|             } else { |             } else { | ||||||
|                 throw new IOException("Cannot synchronise directy to non-directory!"); |                 throw new IOException("Cannot synchronise directory to non-directory!"); | ||||||
|                 // TODO add more detail to error message. |                 // TODO add more detail to error message. | ||||||
|             } |             } | ||||||
|         } else { |         } else { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user