From cb11e94d235703d65a783f843988f51e003a7fe7 Mon Sep 17 00:00:00 2001
From: Guillaume Smet <guillaume.smet@gmail.com>
Date: Fri, 16 Aug 2024 14:09:29 +0200
Subject: [PATCH] Use the root path for OpenContainerPathTree#getRoots()

The container path is the path of the container (could be a directory or
an archive and shouldn't be used for browsing.
The root path is the path of the root. In the case of an archive, it's
actually a ZipPath, which can be used to browse the archive.

Fixes #42571

(cherry picked from commit 6dd61509ce9925d701fe1589a2304ee07a848400)
---
 .../src/main/java/io/quarkus/paths/OpenContainerPathTree.java  | 2 +-
 .../app-model/src/main/java/io/quarkus/paths/PathTree.java     | 3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/independent-projects/bootstrap/app-model/src/main/java/io/quarkus/paths/OpenContainerPathTree.java b/independent-projects/bootstrap/app-model/src/main/java/io/quarkus/paths/OpenContainerPathTree.java
index 5def8099b50bc..7ef8b4eed9533 100644
--- a/independent-projects/bootstrap/app-model/src/main/java/io/quarkus/paths/OpenContainerPathTree.java
+++ b/independent-projects/bootstrap/app-model/src/main/java/io/quarkus/paths/OpenContainerPathTree.java
@@ -93,7 +93,7 @@ public OpenPathTree open() {
 
     @Override
     public Collection<Path> getRoots() {
-        return List.of(getContainerPath());
+        return List.of(getRootPath());
     }
 
     @Override
diff --git a/independent-projects/bootstrap/app-model/src/main/java/io/quarkus/paths/PathTree.java b/independent-projects/bootstrap/app-model/src/main/java/io/quarkus/paths/PathTree.java
index 82b10247e824f..b4287841554ff 100644
--- a/independent-projects/bootstrap/app-model/src/main/java/io/quarkus/paths/PathTree.java
+++ b/independent-projects/bootstrap/app-model/src/main/java/io/quarkus/paths/PathTree.java
@@ -83,8 +83,7 @@ static PathTree ofArchive(Path archive, PathFilter filter) {
     /**
      * The roots of the path tree.
      * <p>
-     * Note that for archives, it will return the path to the archive itself,
-     * not a path that you can browse.
+     * Note that you shouldn't use these roots for browsing except if the PathTree is open.
      *
      * @return roots of the path tree
      */