Skip to content

Commit

Permalink
Respect original tool name
Browse files Browse the repository at this point in the history
  • Loading branch information
stevapple committed Dec 7, 2021
1 parent 8717f9c commit 06c38d3
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions Sources/TSCBasic/misc.swift
Original file line number Diff line number Diff line change
Expand Up @@ -94,18 +94,12 @@ public func lookupExecutablePath(
) -> AbsolutePath? {

// We should have a value to continue.
#if os(Windows)
guard var value = value, !value.isEmpty else {
return nil
}
let isPath = value.contains("\\") || value.contains("/")
if !isPath && !value.contains(".") {
value.append(executableFileSuffix)
}
#else
guard let value = value, !value.isEmpty else {
return nil
}
#if os(Windows)
let isPath = value.contains(":") || value.contains("\\") || value.contains("/")
#else
let isPath = value.contains("/")
#endif

Expand All @@ -124,6 +118,11 @@ public func lookupExecutablePath(
if !isPath {
// Try to locate in search paths.
paths.append(contentsOf: searchPaths.map({ $0.appending(component: value) }))
#if os(Windows)
if !value.contains(".") {
paths.append(contentsOf: searchPaths.map({ $0.appending(component: value + executableFileSuffix) }))
}
#endif
}

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

0 comments on commit 06c38d3

Please sign in to comment.