Skip to content

Commit 773fac3

Browse files
committed
Workspace: handle SWIFTPM_PD_LIBS properly on Windows
This environment variable is needed during bootstrapping. Using `:` as a delimiter does not allow passing a valid windows path as `:` is the drive separator. Use the traditional path separator `;` on Windows and use `:` on the other platforms. This allows setting the correct path to the package description modules.
1 parent 70c43a5 commit 773fac3

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)