gnodet commented on a change in pull request #6:
URL: https://github.com/apache/maven-clean-plugin/pull/6#discussion_r770665481
##########
File path: src/main/java/org/apache/maven/plugins/clean/Cleaner.java
##########
@@ -115,9 +124,63 @@ public void delete( File basedir, Selector selector,
boolean followSymlinks, boo
File file = followSymlinks ? basedir : basedir.getCanonicalFile();
+ if ( selector == null && !followSymlinks && fastFolder != null )
+ {
+ if ( fastDelete( file ) )
+ {
+ return;
+ }
+ }
+
delete( file, "", selector, followSymlinks, failOnError, retryOnError
);
}
+ private boolean fastDelete( File baseDir )
+ {
+ fastFolder.mkdirs();
+ if ( fastFolder.isDirectory() )
+ {
+ try
+ {
+ File tmpDir = createTempDir( fastFolder );
+ File dstDir = new File( tmpDir, baseDir.getName() );
+ Files.move( baseDir.toPath(), dstDir.toPath(),
StandardCopyOption.ATOMIC_MOVE );
Review comment:
Yes, that's why the exception is caught if an atomic move can not be
performed. In which case, the usual deletion will be used.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]