File tree 3 files changed +10
-8
lines changed
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 {
326
326
currentWorkingDirectory: localFileSystem. currentWorkingDirectory
327
327
)
328
328
#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 ) )
331
331
332
332
// 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 ) ) )
335
335
336
336
// The 16-bit Windows system directory
337
- searchPaths += " \( ProcessEnv . vars [ " systemdrive " ] ?? " C: " ) \\ System "
337
+ searchPaths. append ( AbsolutePath ( " \( ProcessEnv . vars [ " systemdrive " ] ?? " C: " ) \\ System " ) )
338
338
339
339
// 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 ) ) )
342
342
343
343
searchPaths. append ( contentsOf: envSearchPaths)
344
344
#else
Original file line number Diff line number Diff line change @@ -92,7 +92,7 @@ public func lookupExecutablePath(
92
92
return nil
93
93
}
94
94
let isPath = value. contains ( " \\ " )
95
- if !isPath && value. contains ( " . " ) {
95
+ if !isPath && ! value. contains ( " . " ) {
96
96
value. append ( executableFileSuffix)
97
97
}
98
98
#else
Original file line number Diff line number Diff line change @@ -137,6 +137,7 @@ class TemporaryFileTests: XCTestCase {
137
137
XCTAssertFalse ( localFileSystem. isDirectory ( pathTwo) )
138
138
}
139
139
140
+ #if !os(Windows) // `fileDescriptor` is currently unavailable in Windows
140
141
/// Check that the temporary file doesn't leak file descriptors.
141
142
func testLeaks( ) throws {
142
143
// We check this by testing that we get back the same FD after a
@@ -150,4 +151,5 @@ class TemporaryFileTests: XCTestCase {
150
151
let endFD = try Int ( withTemporaryFile { return $0. fileHandle. fileDescriptor } )
151
152
XCTAssertEqual ( initialFD, endFD)
152
153
}
154
+ #endif
153
155
}
You can’t perform that action at this time.
0 commit comments