Skip to content

Commit 06c38d3

Browse files
committed
Respect original tool name
1 parent 8717f9c commit 06c38d3

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

Sources/TSCBasic/misc.swift

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -94,18 +94,12 @@ public func lookupExecutablePath(
9494
) -> AbsolutePath? {
9595

9696
// 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
10697
guard let value = value, !value.isEmpty else {
10798
return nil
10899
}
100+
#if os(Windows)
101+
let isPath = value.contains(":") || value.contains("\\") || value.contains("/")
102+
#else
109103
let isPath = value.contains("/")
110104
#endif
111105

@@ -124,6 +118,11 @@ public func lookupExecutablePath(
124118
if !isPath {
125119
// Try to locate in search paths.
126120
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
127126
}
128127

129128
return paths.first(where: { localFileSystem.isExecutableFile($0) })

0 commit comments

Comments
 (0)