From 60a1324a5997e7dc04be9f4c852e117bf4b22924 Mon Sep 17 00:00:00 2001 From: Evan Wilde Date: Thu, 31 Jul 2025 13:14:55 -0700 Subject: [PATCH] Keep executable path The Swift driver uses the location of the driver to search for other binaries including the swift-frontend, legacy driver, etc... Dropping the filepath means that we lose this information and search from the current working directory instead of where the driver exists, which then results in the driver failing. --- Sources/FoundationEssentials/Platform.swift | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Sources/FoundationEssentials/Platform.swift b/Sources/FoundationEssentials/Platform.swift index f769374a1..da4977be8 100644 --- a/Sources/FoundationEssentials/Platform.swift +++ b/Sources/FoundationEssentials/Platform.swift @@ -366,12 +366,10 @@ extension Platform { return String(decodingCString: lpBuffer.baseAddress!, as: UTF16.self) } #elseif !NO_FILESYSTEM - guard let processPath = CommandLine.arguments.first else { - return nil + if let processPath = CommandLine.arguments.first { + return processPath } - return processPath.lastPathComponent -#else - return nil #endif + return nil } }