Skip to content

Commit

Permalink
fix(list files): replace root module with './'
Browse files Browse the repository at this point in the history
  • Loading branch information
nqminhuit committed Mar 2, 2024
1 parent d8f8a4f commit 7a09132
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions src/main/java/org/nqm/vertx/CommandVerticle.java
Original file line number Diff line number Diff line change
Expand Up @@ -190,12 +190,24 @@ private List<Future<Process>> 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));
}
}
Expand Down

0 comments on commit 7a09132

Please sign in to comment.