@@ -90,20 +90,24 @@ open class BuildService: Service, @unchecked Sendable {
9090 let fs = SWBUtil . localFS
9191 var binariesToCheck = [ Path] ( )
9292 // 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+ }
9698 }
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) ) " )
97101 }
98102 // Check all the binaries of frameworks in the Frameworks folder.
99103 // 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 {
101105 do {
102106 for subpath in try fs. listdir ( frameworksPath) {
103107 let frameworkPath = frameworksPath. join ( subpath)
104108 // Load a bundle at this path. This means we'll skip things which aren't bundles, such as the Swift standard libraries.
105109 if let bundle = Bundle ( path: frameworkPath. str) {
106- if let unresolvedExecutablePath = try bundle. executableURL? . filePath {
110+ if let unresolvedExecutablePath = try ? bundle. executableURL? . filePath {
107111 let executablePath = try fs. realpath ( unresolvedExecutablePath)
108112 if fs. exists ( executablePath) {
109113 binariesToCheck. append ( executablePath)
0 commit comments