sdedic commented on a change in pull request #2879:
URL: https://github.com/apache/netbeans/pull/2879#discussion_r613325425



##########
File path: 
extide/gradle/src/org/netbeans/modules/gradle/api/execute/GradleDistributionManager.java
##########
@@ -308,6 +313,46 @@ public GradleDistribution defaultDistribution() {
         return ret;
     }
 
+    /**
+     * Lists all the {@link GradleDistribution}s available on the Gradle Home
+     * of this distribution manager. It looks for the 
<code>$GRADLE_HOME/wrapper/dists</code>
+     * directory for already downloaded distributions.
+     * @return the list of available Gradle distributions from the Gradle Home.
+     * @since 2.10
+     */
+    public List<GradleDistribution> availableLocalDistributions() {
+        List<GradleDistribution> ret = new ArrayList<>();
+        File dists = new File(gradleUserHome, "wrapper/dists"); //NOI18N
+        if (dists.isDirectory()) {
+            try {
+                Files.walkFileTree(dists.toPath(), new 
SimpleFileVisitor<Path>() {
+                    @Override
+                    public FileVisitResult visitFile(Path f, 
BasicFileAttributes attrs) throws IOException {
+                        String fname = f.getFileName().toString();
+                        Matcher m = DIST_VERSION_PATTERN.matcher(fname);
+                        if (m.matches()) {

Review comment:
       oh ! Sorry. Then I'd suggest to stop at level 2 in the file walk 
(f.getNameCount() > dists.getNameCount() + 2)




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

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to