From 283c833888dee728191b03b05a1f7521e7edab41 Mon Sep 17 00:00:00 2001 From: YR Chen Date: Fri, 22 Apr 2022 14:32:18 +0800 Subject: [PATCH] Use clearer variable name --- Sources/TSCBasic/misc.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Sources/TSCBasic/misc.swift b/Sources/TSCBasic/misc.swift index 59198029..2cea465b 100644 --- a/Sources/TSCBasic/misc.swift +++ b/Sources/TSCBasic/misc.swift @@ -225,9 +225,9 @@ public func lookupExecutablePath( return nil } #if os(Windows) - let isPath = value.contains(":") || value.contains("\\") || value.contains("/") + let isFileName = !value.contains(":") && !value.contains("\\") && !value.contains("/") #else - let isPath = value.contains("/") + let isFileName = !value.contains("/") #endif var paths: [AbsolutePath] = [] @@ -241,8 +241,8 @@ public func lookupExecutablePath( paths.append(absPath) } - // Ensure the value is not a path. - if !isPath { + // Only search in PATH if the value is a single path component. + if isFileName { // Try to locate in search paths. paths.append(contentsOf: searchPaths.map({ $0.appending(component: value) })) #if os(Windows)