diff --git a/extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/QuteProcessor.java b/extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/QuteProcessor.java
index e2ab7c880eaed..1b8e728a13d53 100644
--- a/extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/QuteProcessor.java
+++ b/extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/QuteProcessor.java
@@ -2194,7 +2194,7 @@ private void scanPath(Path rootPath, Path path, QuteConfig config, TemplateRoots
                     Path relativePath = rootPath.relativize(file);
                     if (templateRoots.isRoot(relativePath)) {
                         LOGGER.debugf("Found templates dir: %s", file);
-                        scan(file, file, file.getFileName() + "/", watchedPaths, templatePaths,
+                        scan(file, file, relativePath.toString() + File.separatorChar, watchedPaths, templatePaths,
                                 nativeImageResources,
                                 config);
                     } else if (templateRoots.maybeRoot(relativePath)) {
diff --git a/extensions/qute/deployment/src/test/java/io/quarkus/qute/deployment/templateroot/AdditionalTemplateRootTest.java b/extensions/qute/deployment/src/test/java/io/quarkus/qute/deployment/templateroot/AdditionalTemplateRootTest.java
index 202cdbfc8b7e4..7e26be68d7834 100644
--- a/extensions/qute/deployment/src/test/java/io/quarkus/qute/deployment/templateroot/AdditionalTemplateRootTest.java
+++ b/extensions/qute/deployment/src/test/java/io/quarkus/qute/deployment/templateroot/AdditionalTemplateRootTest.java
@@ -2,7 +2,9 @@
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
 
+import java.util.List;
 import java.util.function.Consumer;
+import java.util.stream.Collectors;
 
 import jakarta.inject.Inject;
 
@@ -13,6 +15,8 @@
 import io.quarkus.builder.BuildChainBuilder;
 import io.quarkus.builder.BuildContext;
 import io.quarkus.builder.BuildStep;
+import io.quarkus.deployment.builditem.ServiceStartBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBuildItem;
 import io.quarkus.qute.Engine;
 import io.quarkus.qute.Template;
 import io.quarkus.qute.deployment.TemplateRootBuildItem;
@@ -38,6 +42,29 @@ public void execute(BuildContext context) {
                     }
                 }).produces(TemplateRootBuildItem.class)
                         .build();
+
+                builder.addBuildStep(new BuildStep() {
+                    @Override
+                    public void execute(BuildContext context) {
+                        int found = 0;
+                        List<NativeImageResourceBuildItem> items = context.consumeMulti(NativeImageResourceBuildItem.class);
+                        for (NativeImageResourceBuildItem item : items) {
+                            if (item.getResources().contains("web/public/hello.txt")
+                                    || item.getResources().contains("web\\public\\hello.txt")
+                                    || item.getResources().contains("templates/hi.txt")
+                                    || item.getResources().contains("templates\\hi.txt")) {
+                                found++;
+                            }
+                        }
+                        if (found != 2) {
+                            throw new IllegalStateException(items.stream().flatMap(i -> i.getResources().stream())
+                                    .collect(Collectors.toList()).toString());
+                        }
+                        context.produce(new ServiceStartBuildItem("foo"));
+                    }
+                }).produces(ServiceStartBuildItem.class)
+                        .consumes(NativeImageResourceBuildItem.class)
+                        .build();
             }
         };
     }