Skip to content

Commit

Permalink
debug
Browse files Browse the repository at this point in the history
  • Loading branch information
msbarry committed May 19, 2024
1 parent eb00786 commit c728147
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ public static List<Path> 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 -> {
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit c728147

Please sign in to comment.