We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 906be42 commit 1864abdCopy full SHA for 1864abd
Sources/Testing/Support/FileHandle.swift
@@ -732,7 +732,9 @@ let rootDirectoryPath: String = {
732
// contains the system Windows directory. For an explanation of the difference
733
// between the Windows directory and the _system_ Windows directory, see
734
// https://devblogs.microsoft.com/oldnewthing/20140723-00/?p=423 .
735
- let count = GetSystemWindowsDirectoryW(nil, 0)
+ let count = withUnsafeTemporaryAllocation(of: wchar_t.self, capacity: 1) { buffer in
736
+ GetSystemWindowsDirectoryW(buffer.baseAddress!, buffer.count)
737
+ }
738
if count > 0 {
739
withUnsafeTemporaryAllocation(of: wchar_t.self, capacity: Int(count) + 1) { buffer in
740
_ = GetSystemWindowsDirectoryW(buffer.baseAddress!, UINT(buffer.count))
0 commit comments