File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed
Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -738,11 +738,17 @@ let rootDirectoryPath: String = {
738738 if count > 0 {
739739 withUnsafeTemporaryAllocation ( of: wchar_t. self, capacity: Int ( count) + 1 ) { buffer in
740740 _ = GetSystemWindowsDirectoryW ( buffer. baseAddress!, UINT ( buffer. count) )
741+ let windowsPath = String . decodeCString ( buffer. baseAddress!, as: UTF16 . self) ? . result
741742 let rStrip = PathCchStripToRoot ( buffer. baseAddress!, buffer. count)
742743 if rStrip == S_OK || rStrip == S_FALSE {
743744 result = String . decodeCString ( buffer. baseAddress!, as: UTF16 . self) ? . result
745+ } else {
746+ fatalError ( " Failed to strip Windows path ' \( windowsPath) ': \( rStrip) " )
744747 }
745748 }
749+ } else {
750+ let errorCode = GetLastError ( )
751+ fatalError ( " Failed to get the length of the system Windows directory path: \( errorCode) " )
746752 }
747753
748754 // If we weren't able to get a path, fall back to "C:\" on the assumption that
You can’t perform that action at this time.
0 commit comments