Skip to content

Commit ed19978

Browse files
committed
Fix Windows default search paths
1 parent 06c38d3 commit ed19978

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

Sources/TSCBasic/Process.swift

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -358,18 +358,15 @@ public final class Process {
358358
if GetSystemDirectoryW(&buffer, .init(buffer.count)) > 0 {
359359
searchPaths.append(AbsolutePath(String(decodingCString: buffer, as: UTF16.self)))
360360
}
361-
// The 16-bit Windows system directory
362-
if let systemDrive = ProcessEnv.vars["systemdrive"],
363-
let systemPath = try? AbsolutePath(validating: "\(systemDrive))\\System") {
364-
searchPaths.append(systemPath)
365-
}
366-
// The Windows directory
367361
if GetWindowsDirectoryW(&buffer, .init(buffer.count)) > 0 {
368-
searchPaths.append(AbsolutePath(String(decodingCString: buffer, as: UTF16.self)))
362+
let windowsDirectory = String(decodingCString: buffer, as: UTF16.self)
363+
// The 16-bit Windows system directory
364+
searchPaths.append(AbsolutePath("\(windowsDirectory)\\System"))
365+
// The Windows directory
366+
searchPaths.append(AbsolutePath(windowsDirectory))
369367
}
370368
#endif
371369
searchPaths.append(contentsOf: envSearchPaths)
372-
// Lookup and cache the executable path.
373370
let value = lookupExecutablePath(
374371
filename: program,
375372
currentWorkingDirectory: cwdOpt,

0 commit comments

Comments
 (0)