diff --git a/Sources/PathKit.swift b/Sources/PathKit.swift index 3cf558f..7b7a5f7 100644 --- a/Sources/PathKit.swift +++ b/Sources/PathKit.swift @@ -596,7 +596,7 @@ extension Path { free(cPattern) } - let flags = GLOB_TILDE | GLOB_BRACE | GLOB_MARK + let flags = GLOB_TILDE | GLOB_BRACE | GLOB_MARK | GLOB_NOESCAPE if system_glob(cPattern, flags, nil, >) == 0 { #if os(Linux) let matchc = gt.gl_pathc diff --git a/Tests/PathKitTests/PathKitSpec.swift b/Tests/PathKitTests/PathKitSpec.swift index 7abab91..89f743b 100644 --- a/Tests/PathKitTests/PathKitSpec.swift +++ b/Tests/PathKitTests/PathKitSpec.swift @@ -507,6 +507,11 @@ describe("PathKit") { let results = try (fixtures + "permissions").children().map { $0.absolute() }.sorted(by: <) try expect(paths) == results.sorted(by: <) } + + $0.it("can glob nested directories using **") { + let paths = fixtures.glob("**/child") + try expect(paths) == [fixtures + "directory/subdirectory/child", fixtures + "directory/child"] + } } $0.describe("#match") {