From 35e5816854d4582244b7baa13fc2d684e88c006f Mon Sep 17 00:00:00 2001 From: Miroslav Pokorny Date: Mon, 3 Jul 2023 22:36:48 +1000 Subject: [PATCH] J2clSourcesKind Paths.isAbsolute rather than leading slash test --- .../walkingkooka/j2cl/maven/J2clSourcesKind.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main/java/walkingkooka/j2cl/maven/J2clSourcesKind.java b/src/main/java/walkingkooka/j2cl/maven/J2clSourcesKind.java index 2d78ec4f..6517002c 100644 --- a/src/main/java/walkingkooka/j2cl/maven/J2clSourcesKind.java +++ b/src/main/java/walkingkooka/j2cl/maven/J2clSourcesKind.java @@ -22,6 +22,7 @@ import org.apache.maven.project.MavenProject; import java.nio.file.Files; +import java.nio.file.Path; import java.nio.file.Paths; import java.util.Arrays; import java.util.Collection; @@ -93,18 +94,18 @@ private static List concat(final Function mapper, .filter(Objects::nonNull) .flatMap(Collection::stream) .map(mapper) - .map(p -> p.startsWith(SEPARATOR) ? - p : - base + SEPARATOR + p - ).map(Paths::get) + .map(p -> { + final Path path = Paths.get(p); + return path.isAbsolute() ? + path : + Paths.get(base.toString(), p); + }) .filter(Files::exists) .map(J2clPath::with) .distinct() .collect(Collectors.toList()); } - private final static String SEPARATOR = "/"; - @SafeVarargs private static List concat(final List... sources) { return Arrays.stream(sources)