File tree 2 files changed +7
-4
lines changed
2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -90,20 +90,20 @@ 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 {
93
+ if let executablePath = try ? Bundle . main. executableURL? . filePath {
94
94
if fs. exists ( executablePath) {
95
95
binariesToCheck. append ( executablePath)
96
96
}
97
97
}
98
98
// Check all the binaries of frameworks in the Frameworks folder.
99
99
// 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 {
100
+ if let frameworksPath = try ? Bundle . main. privateFrameworksURL? . filePath {
101
101
do {
102
102
for subpath in try fs. listdir ( frameworksPath) {
103
103
let frameworkPath = frameworksPath. join ( subpath)
104
104
// Load a bundle at this path. This means we'll skip things which aren't bundles, such as the Swift standard libraries.
105
105
if let bundle = Bundle ( path: frameworkPath. str) {
106
- if let unresolvedExecutablePath = try bundle. executableURL? . filePath {
106
+ if let unresolvedExecutablePath = try ? bundle. executableURL? . filePath {
107
107
let executablePath = try fs. realpath ( unresolvedExecutablePath)
108
108
if fs. exists ( executablePath) {
109
109
binariesToCheck. append ( executablePath)
Original file line number Diff line number Diff line change @@ -28,7 +28,9 @@ extension URL {
28
28
throw FileURLError . notRepresentable ( self )
29
29
}
30
30
let fp = Path ( String ( cString: cString) )
31
- precondition ( fp. isAbsolute, " path ' \( fp. str) ' is not absolute " )
31
+ guard fp. isAbsolute else {
32
+ throw FileURLError . pathNotAbsolute ( self )
33
+ }
32
34
return fp
33
35
}
34
36
}
@@ -37,4 +39,5 @@ extension URL {
37
39
38
40
fileprivate enum FileURLError : Error {
39
41
case notRepresentable( URL )
42
+ case pathNotAbsolute( URL )
40
43
}
You can’t perform that action at this time.
0 commit comments