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 @@ -97,6 +97,11 @@ public func lookupExecutablePath(
9797 guard let value = value, !value. isEmpty else {
9898 return nil
9999 }
100+ #if os(Windows)
101+ let isPath = value. contains ( " : " ) || value. contains ( " \\ " ) || value. contains ( " / " )
102+ #else
103+ let isPath = value. contains ( " / " )
104+ #endif
100105
101106 var paths : [ AbsolutePath ] = [ ]
102107
@@ -110,9 +115,14 @@ public func lookupExecutablePath(
110115 }
111116
112117 // Ensure the value is not a path.
113- if !value . contains ( " / " ) {
118+ if !isPath {
114119 // Try to locate in search paths.
115120 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
116126 }
117127
118128 return paths. first ( where: { localFileSystem. isExecutableFile ( $0) } )
You can’t perform that action at this time.
0 commit comments