From 6e1eeb158ae0e71da3af23ef869aa0dc1adf7355 Mon Sep 17 00:00:00 2001 From: Max Howell Date: Sat, 25 Jan 2020 12:44:46 -0500 Subject: [PATCH] No fatal on linux Swift < 5 --- Sources/Path+ls.swift | 4 ++++ Tests/PathTests/PathTests+ls().swift | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Sources/Path+ls.swift b/Sources/Path+ls.swift index 0ca4487..ce29a1b 100644 --- a/Sources/Path+ls.swift +++ b/Sources/Path+ls.swift @@ -130,7 +130,11 @@ public extension Path.Finder { while let path = next() { switch try closure(path) { case .skip: + #if !os(Linux) || swift(>=5.0) enumerator.skipDescendants() + #else + fputs("warning: skip is not implemented for Swift < 5.0\n", stderr) + #endif case .abort: return case .continue: diff --git a/Tests/PathTests/PathTests+ls().swift b/Tests/PathTests/PathTests+ls().swift index 893399e..2d5dafd 100644 --- a/Tests/PathTests/PathTests+ls().swift +++ b/Tests/PathTests/PathTests+ls().swift @@ -169,7 +169,7 @@ extension PathTests { try tmpdir.b.mkdir().join("c").touch() try tmpdir.b.d.mkdir().join("e").touch() try tmpdir.b.d.f.mkdir().join("g").touch() - + #if !os(Linux) || swift(>=5) do { var rv = Set() @@ -184,6 +184,7 @@ extension PathTests { XCTAssertEqual(rv, Set([tmpdir.a, tmpdir.b, tmpdir.b.c].map(Path.init))) } + #endif do { var x = 0