From c72814748048cef89bb15173713ba931c2d6d2c4 Mon Sep 17 00:00:00 2001 From: Mike Barry Date: Sun, 19 May 2024 16:44:06 -0400 Subject: [PATCH] debug --- .../java/com/onthegomap/planetiler/util/FileUtils.java | 3 ++- .../java/com/onthegomap/planetiler/util/GlobTest.java | 9 ++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/planetiler-core/src/main/java/com/onthegomap/planetiler/util/FileUtils.java b/planetiler-core/src/main/java/com/onthegomap/planetiler/util/FileUtils.java index 294481e47e..24efa3d65d 100644 --- a/planetiler-core/src/main/java/com/onthegomap/planetiler/util/FileUtils.java +++ b/planetiler-core/src/main/java/com/onthegomap/planetiler/util/FileUtils.java @@ -87,7 +87,8 @@ public static List walkPathWithPattern(Path basePath, String pattern, return walk .filter(path -> { System.err.println( - " " + basePath + " " + basePath.relativize(path) + " " + matcher.matches(basePath.relativize(path))); + " " + basePath + " " + pattern + " " + basePath.relativize(path) + " " + + matcher.matches(basePath.relativize(path))); return matcher.matches(path.getFileName()) || matcher.matches(basePath.relativize(path)); }) .flatMap(path -> { diff --git a/planetiler-core/src/test/java/com/onthegomap/planetiler/util/GlobTest.java b/planetiler-core/src/test/java/com/onthegomap/planetiler/util/GlobTest.java index edc33f38c3..e038e2c865 100644 --- a/planetiler-core/src/test/java/com/onthegomap/planetiler/util/GlobTest.java +++ b/planetiler-core/src/test/java/com/onthegomap/planetiler/util/GlobTest.java @@ -1,7 +1,6 @@ package com.onthegomap.planetiler.util; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.IOException; import java.nio.file.FileSystems; @@ -44,8 +43,12 @@ void testWalkPathWithPattern() throws IOException { FileUtils.createParentDirectories(path); Files.writeString(path, "test"); var sep = path.getFileSystem().getSeparator(); - assertTrue( - path.getFileSystem().getPathMatcher("*" + sep + "*" + sep + "c.txt").matches(Path.of("a", "b", "c.txt"))); + System.err.println("============"); + System.err.println( + path.getFileSystem().getPathMatcher("glob:*" + sep + "*" + sep + "c.txt").matches(Path.of("a", "b", "c.txt"))); + System.err.println(path.getFileSystem().getPathMatcher("glob:." + sep + "*" + sep + "*" + sep + "c.txt") + .matches(Path.of("a", "b", "c.txt"))); + System.err.println(path.getFileSystem().getPathMatcher("glob:*/*/c.txt").matches(Path.of("a", "b", "c.txt"))); assertEquals(List.of(path), Glob.of(tmpDir).resolve("a", "*", "c.txt").find()); System.err.println(Glob.of(tmpDir).resolve("*", "*", "c.txt")); System.err.println(Glob.of(tmpDir).resolve("*", "*", "c.txt").find()); // nope