Skip to content

Commit 284ef20

Browse files
committed
ASTGen: account for alternate path separators
Windows supports `\` and `/` as path separators. Account for both in computing the basename. This repairs a few test failures on Windows.
1 parent ffc9fb3 commit 284ef20

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/ASTGen/Sources/ASTGen/SourceManager+MacroExpansionContext.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ extension String {
4343
/// Retrieve the base name of a string that represents a path, removing the
4444
/// directory.
4545
var basename: String {
46-
guard let lastSlash = lastIndex(of: "/") else {
46+
guard let lastSlash = lastIndex(where: { ["/", "\\"].contains($0) }) else {
4747
return self
4848
}
4949

0 commit comments

Comments
 (0)