文章中 https://stackoverflow.com/a/62999523/7887882 中提到:tests/**/*.java 可以匹配 tests/HelloWorld.java ,为什么我实验的结果为 false 呢?
Kotlin 代码如下:
val pathMatcher: PathMatcher = FileSystems.getDefault().getPathMatcher("glob:tests/**/*.java")
println(pathMatcher.matches(Paths.get("tests/HelloWorld.java"))) // 为什么这里会是 false
println(pathMatcher.matches(Paths.get("tests/ui/HelloWorld.java"))) // true ,符合预期
println(pathMatcher.matches(Paths.get("tests/ui/feature1/HelloWorld.java"))) // true ,符合预期
1
knightdf 2022-05-24 23:22:30 +08:00
样例中有 /home/** Matches /home/gus and /home/gus/data on UNIX platforms
|
2
HarryQu OP |
3
XhstormR02 2022-05-25 08:23:04 +08:00 via Android
|