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 @@ -326,19 +326,19 @@ public final class Process: ObjectIdentifierProtocol {
326326 currentWorkingDirectory: localFileSystem. currentWorkingDirectory
327327 )
328328#if os(Windows)
329- var searchPaths = [ String ] ( )
330- let buffer = UnsafeMutablePointer < String > . allocate ( capacity : 260 )
329+ var searchPaths = Array < AbsolutePath > ( )
330+ var buffer = Array < WCHAR > ( repeating : 0 , count : Int ( MAX_PATH + 1 ) )
331331
332332 // The 32-bit Windows system directory
333- GetSystemDirectoryW ( buffer, 260 )
334- searchPaths += buffer. pointee
333+ GetSystemDirectoryW ( & buffer, . init ( MAX_PATH + 1 ) )
334+ searchPaths. append ( AbsolutePath ( String ( decodingCString : buffer, as : UTF16 . self ) ) )
335335
336336 // The 16-bit Windows system directory
337- searchPaths += " \( ProcessEnv . vars [ " systemdrive " ] ?? " C: " ) \\ System "
337+ searchPaths. append ( AbsolutePath ( " \( ProcessEnv . vars [ " systemdrive " ] ?? " C: " ) \\ System " ) )
338338
339339 // The Windows directory
340- GetWindowsDirectoryW ( buffer, 260 )
341- searchPaths += buffer. pointee
340+ GetWindowsDirectoryW ( & buffer, . init ( MAX_PATH + 1 ) )
341+ searchPaths. append ( AbsolutePath ( String ( decodingCString : buffer, as : UTF16 . self ) ) )
342342
343343 searchPaths. append ( contentsOf: envSearchPaths)
344344#else
Original file line number Diff line number Diff line change @@ -92,7 +92,7 @@ public func lookupExecutablePath(
9292 return nil
9393 }
9494 let isPath = value. contains ( " \\ " )
95- if !isPath && value. contains ( " . " ) {
95+ if !isPath && ! value. contains ( " . " ) {
9696 value. append ( executableFileSuffix)
9797 }
9898#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
@@ -150,4 +151,5 @@ class TemporaryFileTests: XCTestCase {
150151 let endFD = try Int ( withTemporaryFile { return $0. fileHandle. fileDescriptor } )
151152 XCTAssertEqual ( initialFD, endFD)
152153 }
154+ #endif
153155}
You can’t perform that action at this time.
0 commit comments