File tree Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -146,7 +146,7 @@ struct SwiftcRunner {
146
146
/// - lib/
147
147
/// - swift/
148
148
/// - ${target}/
149
- /// - ${arch}/ (only on !Darwin)
149
+ /// - ${arch}/ (only on !Darwin and if launched from Xcode )
150
150
/// - libswiftSwiftSyntax.[dylib|so]
151
151
/// ```
152
152
static func locateSwiftc( ) -> URL ? {
@@ -156,9 +156,13 @@ struct SwiftcRunner {
156
156
. deletingLastPathComponent ( )
157
157
. deletingLastPathComponent ( )
158
158
. deletingLastPathComponent ( )
159
- #if !os(macOS)
160
- swiftcURL = swiftcURL. deletingLastPathComponent ( )
161
- #endif
159
+
160
+ if swiftcURL. lastPathComponent == " lib " {
161
+ // We are still one level to deep because we started in ${arch},
162
+ // not ${target}, see comment above). Traverse one more level upwards
163
+ swiftcURL = swiftcURL. deletingLastPathComponent ( )
164
+ }
165
+
162
166
swiftcURL = swiftcURL. appendingPathComponent ( " bin " )
163
167
. appendingPathComponent ( " swiftc " )
164
168
guard FileManager . default. fileExists ( atPath: swiftcURL. path) else {
Original file line number Diff line number Diff line change 86
86
}
87
87
exit ( 0 )
88
88
} catch {
89
- printerr ( error. localizedDescription )
89
+ printerr ( " \( error) " )
90
90
printerr ( " Run swift-swiftsyntax-test -help for more help. " )
91
91
exit ( 1 )
92
92
}
You can’t perform that action at this time.
0 commit comments