Skip to content

Commit cebb305

Browse files
authored
Merge pull request swiftlang#2874 from compnerd/joined-at-the-colon
Workspace: handle `SWIFTPM_PD_LIBS` properly on Windows
2 parents 70c43a5 + 773fac3 commit cebb305

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

Sources/Workspace/UserToolchain.swift

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,8 +269,14 @@ public final class UserToolchain: Toolchain {
269269

270270
// Look for an override in the env.
271271
if let pdLibDirEnvStr = ProcessEnv.vars["SWIFTPM_PD_LIBS"] {
272-
// We pick the first path which exists in a colon seperated list.
273-
let paths = pdLibDirEnvStr.split(separator: ":").map(String.init)
272+
// We pick the first path which exists in an environment variable
273+
// delimited by the platform specific string separator.
274+
#if os(Windows)
275+
let separator: Character = ";"
276+
#else
277+
let separator: Character = ":"
278+
#endif
279+
let paths = pdLibDirEnvStr.split(separator: separator).map(String.init)
274280
var foundPDLibDir = false
275281
for pathString in paths {
276282
if let path = try? AbsolutePath(validating: pathString), localFileSystem.exists(path) {

0 commit comments

Comments
 (0)