Skip to content

Commit e84a970

Browse files
committed
Foundation: clear up string abuse on Windows
Use the file system representation of the path rather than encoding the raw path as a UTF16 string.
1 parent 6167997 commit e84a970

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Diff for: Foundation/Process.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,7 @@ open class Process: NSObject {
632632

633633
let workingDirectory = currentDirectoryURL?.path ?? FileManager.default.currentDirectoryPath
634634
try quoteWindowsCommandLine(command).withCString(encodedAs: UTF16.self) { wszCommandLine in
635-
try workingDirectory.withCString(encodedAs: UTF16.self) { wszCurrentDirectory in
635+
try FileManager.default._fileSystemRepresentation(withPath: workingDirectory) { wszCurrentDirectory in
636636
try szEnvironment.withCString(encodedAs: UTF16.self) { wszEnvironment in
637637
if !CreateProcessW(nil, UnsafeMutablePointer<WCHAR>(mutating: wszCommandLine),
638638
nil, nil, true,

0 commit comments

Comments
 (0)