File tree Expand file tree Collapse file tree 3 files changed +10
-8
lines changed
Expand file tree Collapse file tree 3 files changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -352,19 +352,19 @@ public final class Process {
352352 currentWorkingDirectory: cwdOpt
353353 )
354354#if os(Windows)
355- var searchPaths = [ String ] ( )
356- let buffer = UnsafeMutablePointer < String > . allocate ( capacity : 260 )
355+ var searchPaths = Array < AbsolutePath > ( )
356+ var buffer = Array < WCHAR > ( repeating : 0 , count : Int ( MAX_PATH + 1 ) )
357357
358358 // The 32-bit Windows system directory
359- GetSystemDirectoryW ( buffer, 260 )
360- searchPaths += buffer. pointee
359+ GetSystemDirectoryW ( & buffer, . init ( MAX_PATH + 1 ) )
360+ searchPaths. append ( AbsolutePath ( String ( decodingCString : buffer, as : UTF16 . self ) ) )
361361
362362 // The 16-bit Windows system directory
363- searchPaths += " \( ProcessEnv . vars [ " systemdrive " ] ?? " C: " ) \\ System "
363+ searchPaths. append ( AbsolutePath ( " \( ProcessEnv . vars [ " systemdrive " ] ?? " C: " ) \\ System " ) )
364364
365365 // The Windows directory
366- GetWindowsDirectoryW ( buffer, 260 )
367- searchPaths += buffer. pointee
366+ GetWindowsDirectoryW ( & buffer, . init ( MAX_PATH + 1 ) )
367+ searchPaths. append ( AbsolutePath ( String ( decodingCString : buffer, as : UTF16 . self ) ) )
368368
369369 searchPaths. append ( contentsOf: envSearchPaths)
370370#else
Original file line number Diff line number Diff line change @@ -99,7 +99,7 @@ public func lookupExecutablePath(
9999 return nil
100100 }
101101 let isPath = value. contains ( " \\ " )
102- if !isPath && value. contains ( " . " ) {
102+ if !isPath && ! value. contains ( " . " ) {
103103 value. append ( executableFileSuffix)
104104 }
105105#else
Original file line number Diff line number Diff line change @@ -137,6 +137,7 @@ class TemporaryFileTests: XCTestCase {
137137 XCTAssertFalse ( localFileSystem. isDirectory ( pathTwo) )
138138 }
139139
140+ #if !os(Windows) // `fileDescriptor` is currently unavailable in Windows
140141 /// Check that the temporary file doesn't leak file descriptors.
141142 func testLeaks( ) throws {
142143 // We check this by testing that we get back the same FD after a
@@ -152,4 +153,5 @@ class TemporaryFileTests: XCTestCase {
152153 XCTAssertEqual ( initialFD, endFD)
153154 #endif
154155 }
156+ #endif
155157}
You can’t perform that action at this time.
0 commit comments