File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change 83
83
// invocation for a multi-call binary.
84
84
let executable : URL = URL ( fileURLWithPath: ProcessInfo . processInfo. arguments [ 0 ] )
85
85
let invocation : URL = URL ( fileURLWithPath: CommandLine . arguments [ 0 ] )
86
+
87
+ #if compiler(>=6.2)
86
88
let legacyExecutablePath : URL =
89
+ executable. deletingLastPathComponent ( )
90
+ . appendingPathComponent ( " \( invocation. deletingPathExtension ( ) . lastPathComponent) -legacy-driver " )
91
+ . appendingPathExtension ( executable. pathExtension)
92
+ #else
93
+ // WORKAROUND: Check if the original path has a non-empty extension because
94
+ // `url.deletingPathExtension().appendingPathExtension(url.pathExtension)`
95
+ // will not be equal to `url` but be `\(url).` if `url` doesn't have an
96
+ // extension on Swift 6.0. Remove this when we drop support for Swift 6.0
97
+ // as a bootstrapping compiler.
98
+ // See https://github.com/swiftlang/swift-foundation/issues/1080
99
+ var legacyExecutablePath : URL =
87
100
executable. deletingLastPathComponent ( )
88
101
. appendingPathComponent ( " \( invocation. deletingPathExtension ( ) . lastPathComponent) -legacy-driver " )
89
- . appendingPathExtension ( executable. pathExtension)
102
+ if !executable. pathExtension. isEmpty {
103
+ legacyExecutablePath. appendPathExtension ( executable. pathExtension)
104
+ }
105
+ #endif
90
106
let path : String = legacyExecutablePath. withUnsafeFileSystemRepresentation { String ( cString: $0!) }
91
107
92
108
if localFileSystem. exists ( AbsolutePath ( path) ) {
You can’t perform that action at this time.
0 commit comments