From dae71e3112990e2d518b914a4e0813df77291fa4 Mon Sep 17 00:00:00 2001 From: Dmitriy Dolovov Date: Thu, 23 Dec 2021 01:48:14 +0300 Subject: [PATCH] [Native][tests] Fix globs expansion on Windows --- .../jetbrains/kotlin/konan/blackboxtest/support/util/Globs.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/support/util/Globs.kt b/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/support/util/Globs.kt index cb5032c5b18..3d1e2f1b9d7 100644 --- a/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/support/util/Globs.kt +++ b/native/native.tests/tests/org/jetbrains/kotlin/konan/blackboxtest/support/util/Globs.kt @@ -25,7 +25,9 @@ internal fun expandGlobTo(unexpandedPath: File, output: MutableCollection) val basePath: File = paths[index - 1] val basePathAsPath: Path = basePath.toPath() - val pattern: String = unexpandedPath.relativeTo(basePath).path + val pattern: String = unexpandedPath.relativeTo(basePath).path.let { pattern -> + if (File.separatorChar == '\\') pattern.replace("\\", "\\\\") else pattern + } val matcher: PathMatcher = FileSystems.getDefault().getPathMatcher("glob:$pattern") Files.walkFileTree(basePathAsPath, object : SimpleFileVisitor() {