File tree 1 file changed +8
-9
lines changed
1 file changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -94,18 +94,12 @@ public func lookupExecutablePath(
94
94
) -> AbsolutePath ? {
95
95
96
96
// We should have a value to continue.
97
- #if os(Windows)
98
- guard var value = value, !value. isEmpty else {
99
- return nil
100
- }
101
- let isPath = value. contains ( " \\ " ) || value. contains ( " / " )
102
- if !isPath && !value. contains ( " . " ) {
103
- value. append ( executableFileSuffix)
104
- }
105
- #else
106
97
guard let value = value, !value. isEmpty else {
107
98
return nil
108
99
}
100
+ #if os(Windows)
101
+ let isPath = value. contains ( " : " ) || value. contains ( " \\ " ) || value. contains ( " / " )
102
+ #else
109
103
let isPath = value. contains ( " / " )
110
104
#endif
111
105
@@ -124,6 +118,11 @@ public func lookupExecutablePath(
124
118
if !isPath {
125
119
// Try to locate in search paths.
126
120
paths. append ( contentsOf: searchPaths. map ( { $0. appending ( component: value) } ) )
121
+ #if os(Windows)
122
+ if !value. contains ( " . " ) {
123
+ paths. append ( contentsOf: searchPaths. map ( { $0. appending ( component: value + executableFileSuffix) } ) )
124
+ }
125
+ #endif
127
126
}
128
127
129
128
return paths. first ( where: { localFileSystem. isExecutableFile ( $0) } )
You can’t perform that action at this time.
0 commit comments