Skip to content

Commit 283c833

Browse files
committed
Use clearer variable name
1 parent 947f56f commit 283c833

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Sources/TSCBasic/misc.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -225,9 +225,9 @@ public func lookupExecutablePath(
225225
return nil
226226
}
227227
#if os(Windows)
228-
let isPath = value.contains(":") || value.contains("\\") || value.contains("/")
228+
let isFileName = !value.contains(":") && !value.contains("\\") && !value.contains("/")
229229
#else
230-
let isPath = value.contains("/")
230+
let isFileName = !value.contains("/")
231231
#endif
232232

233233
var paths: [AbsolutePath] = []
@@ -241,8 +241,8 @@ public func lookupExecutablePath(
241241
paths.append(absPath)
242242
}
243243

244-
// Ensure the value is not a path.
245-
if !isPath {
244+
// Only search in PATH if the value is a single path component.
245+
if isFileName {
246246
// Try to locate in search paths.
247247
paths.append(contentsOf: searchPaths.map({ $0.appending(component: value) }))
248248
#if os(Windows)

0 commit comments

Comments
 (0)