Skip to content

Commit 7ffb21c

Browse files
authored
Keep executable path (#1459)
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.
1 parent f178c1a commit 7ffb21c

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

Sources/FoundationEssentials/Platform.swift

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -366,12 +366,10 @@ extension Platform {
366366
return String(decodingCString: lpBuffer.baseAddress!, as: UTF16.self)
367367
}
368368
#elseif !NO_FILESYSTEM
369-
guard let processPath = CommandLine.arguments.first else {
370-
return nil
369+
if let processPath = CommandLine.arguments.first {
370+
return processPath
371371
}
372-
return processPath.lastPathComponent
373-
#else
374-
return nil
375372
#endif
373+
return nil
376374
}
377375
}

0 commit comments

Comments
 (0)