gnodet commented on a change in pull request #6:
URL: https://github.com/apache/maven-clean-plugin/pull/6#discussion_r771444116



##########
File path: src/main/java/org/apache/maven/plugins/clean/Cleaner.java
##########
@@ -115,9 +135,102 @@ public void delete( File basedir, Selector selector, 
boolean followSymlinks, boo
 
         File file = followSymlinks ? basedir : basedir.getCanonicalFile();
 
+        if ( selector == null && !followSymlinks && fastDir != null )
+        {
+            // If anything wrong happens, we'll just use the usual deletion 
mechanism
+            if ( fastDelete( file ) )
+            {
+                return;
+            }
+        }
+
         delete( file, "", selector, followSymlinks, failOnError, retryOnError 
);
     }
 
+    private boolean fastDelete( File baseDir )
+    {
+        // Handle the case where we use 
${maven.multiModuleProjectDirectory}/target/.clean for example
+        if ( fastDir.getAbsolutePath().startsWith( baseDir.getAbsolutePath() ) 
)

Review comment:
       I don't think using `Path` will change anything...
   That would look like:
   ```
           fastDir.toPath().startsWith( baseDir.toPath() )
   ```
   but I think the semantics will be exactly the same.




-- 
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]


Reply via email to