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 {
352
352
currentWorkingDirectory: cwdOpt
353
353
)
354
354
#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 ) )
357
357
358
358
// 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 ) ) )
361
361
362
362
// The 16-bit Windows system directory
363
- searchPaths += " \( ProcessEnv . vars [ " systemdrive " ] ?? " C: " ) \\ System "
363
+ searchPaths. append ( AbsolutePath ( " \( ProcessEnv . vars [ " systemdrive " ] ?? " C: " ) \\ System " ) )
364
364
365
365
// 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 ) ) )
368
368
369
369
searchPaths. append ( contentsOf: envSearchPaths)
370
370
#else
Original file line number Diff line number Diff line change @@ -99,7 +99,7 @@ public func lookupExecutablePath(
99
99
return nil
100
100
}
101
101
let isPath = value. contains ( " \\ " )
102
- if !isPath && value. contains ( " . " ) {
102
+ if !isPath && ! value. contains ( " . " ) {
103
103
value. append ( executableFileSuffix)
104
104
}
105
105
#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
@@ -152,4 +153,5 @@ class TemporaryFileTests: XCTestCase {
152
153
XCTAssertEqual ( initialFD, endFD)
153
154
#endif
154
155
}
156
+ #endif
155
157
}
You can’t perform that action at this time.
0 commit comments