From 7a09132d194dfd556f2456e004105233d1f2df2d Mon Sep 17 00:00:00 2001 From: minh Date: Sat, 2 Mar 2024 14:58:31 +0700 Subject: [PATCH] fix(list files): replace root module with './' --- .../java/org/nqm/vertx/CommandVerticle.java | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/nqm/vertx/CommandVerticle.java b/src/main/java/org/nqm/vertx/CommandVerticle.java index da773c3..b5efd42 100644 --- a/src/main/java/org/nqm/vertx/CommandVerticle.java +++ b/src/main/java/org/nqm/vertx/CommandVerticle.java @@ -190,12 +190,24 @@ private List> gisExecuteCommand(Process pr, String cmd) { private void safelyConcatModuleNames(Process pr) { var input = new BufferedReader(new InputStreamReader(pr.getInputStream())); var sb = new StringBuilder(); + var isRootModule = path.toFile() + .listFiles((d, f) -> { + var stringF = "" + f; + return ".gitmodules".equals(stringF) || ".gis-modules".equals(stringF); + }).length > 0; + + var line = ""; + var shortPath = path.getFileName(); + try { - var line = ""; - var shortPath = path.getFileName(); while (isNotBlank(line = input.readLine())) { var f = "%s/%s".formatted(path, line); - if (new File(f).isFile()) { + if (!new File(f).isFile()) { + continue; + } + if (isRootModule) { + sb.append("./%s%n".formatted(line)); + } else { sb.append("%s/%s%n".formatted(shortPath, line)); } }