Skip to content

Commit a61e6e7

Browse files
committed
ASTGen: special case the Apple and Linux platforms
There is no real reason to split the behaviour here as this is a file system primitive. Special case Apple and Linux platforms to address feedback.
1 parent 284ef20 commit a61e6e7

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,13 @@ 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(where: { ["/", "\\"].contains($0) }) else {
46+
guard let lastSlash = lastIndex(where: {
47+
#if os(iOS) || os(macOS) || os(tvOS) || os(watchOS) || os(Android) || os(Linux)
48+
["/"].contains($0)
49+
#else
50+
["/", "\\"].contains($0)
51+
#endif
52+
}) else {
4753
return self
4854
}
4955

0 commit comments

Comments
 (0)