File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -224,6 +224,11 @@ public func lookupExecutablePath(
224224 guard let value = value, !value. isEmpty else {
225225 return nil
226226 }
227+ #if os(Windows)
228+ let isPath = value. contains ( " : " ) || value. contains ( " \\ " ) || value. contains ( " / " )
229+ #else
230+ let isPath = value. contains ( " / " )
231+ #endif
227232
228233 var paths : [ AbsolutePath ] = [ ]
229234
@@ -237,9 +242,14 @@ public func lookupExecutablePath(
237242 }
238243
239244 // Ensure the value is not a path.
240- if !value . contains ( " / " ) {
245+ if !isPath {
241246 // Try to locate in search paths.
242247 paths. append ( contentsOf: searchPaths. map ( { $0. appending ( component: value) } ) )
248+ #if os(Windows)
249+ if !value. contains ( " . " ) {
250+ paths. append ( contentsOf: searchPaths. map ( { $0. appending ( component: value + executableFileSuffix) } ) )
251+ }
252+ #endif
243253 }
244254
245255 return paths. first ( where: { localFileSystem. isExecutableFile ( $0) } )
You can’t perform that action at this time.
0 commit comments