@@ -90,20 +90,24 @@ open class BuildService: Service, @unchecked Sendable {
90
90
let fs = SWBUtil . localFS
91
91
var binariesToCheck = [ Path] ( )
92
92
// Check our own bundle's executable.
93
- if let executablePath = try Bundle . main. executableURL? . filePath {
94
- if fs. exists ( executablePath) {
95
- binariesToCheck. append ( executablePath)
93
+ do {
94
+ if let executablePath = try Bundle . main. executableURL? . filePath {
95
+ if fs. exists ( executablePath) {
96
+ binariesToCheck. append ( executablePath)
97
+ }
96
98
}
99
+ } catch {
100
+ throw StubError . error ( " Couldn't get main bundle executable URL. Error: \( error) , bundle: \( Bundle . main) , url: \( String ( describing: Bundle . main. executableURL) ) , path: \( String ( describing: try ? Bundle . main. executableURL? . filePath) ) " )
97
101
}
98
102
// Check all the binaries of frameworks in the Frameworks folder.
99
103
// Note that this does not recurse into the frameworks for other items nested inside them. We also presently don't check the PlugIns folder.
100
- if let frameworksPath = try Bundle . main. privateFrameworksURL? . filePath {
104
+ if let frameworksPath = try ? Bundle . main. privateFrameworksURL? . filePath {
101
105
do {
102
106
for subpath in try fs. listdir ( frameworksPath) {
103
107
let frameworkPath = frameworksPath. join ( subpath)
104
108
// Load a bundle at this path. This means we'll skip things which aren't bundles, such as the Swift standard libraries.
105
109
if let bundle = Bundle ( path: frameworkPath. str) {
106
- if let unresolvedExecutablePath = try bundle. executableURL? . filePath {
110
+ if let unresolvedExecutablePath = try ? bundle. executableURL? . filePath {
107
111
let executablePath = try fs. realpath ( unresolvedExecutablePath)
108
112
if fs. exists ( executablePath) {
109
113
binariesToCheck. append ( executablePath)
0 commit comments