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 = {
738
738
if count > 0 {
739
739
withUnsafeTemporaryAllocation ( of: wchar_t. self, capacity: Int ( count) + 1 ) { buffer in
740
740
_ = GetSystemWindowsDirectoryW ( buffer. baseAddress!, UINT ( buffer. count) )
741
+ let windowsPath = String . decodeCString ( buffer. baseAddress!, as: UTF16 . self) ? . result
741
742
let rStrip = PathCchStripToRoot ( buffer. baseAddress!, buffer. count)
742
743
if rStrip == S_OK || rStrip == S_FALSE {
743
744
result = String . decodeCString ( buffer. baseAddress!, as: UTF16 . self) ? . result
745
+ } else {
746
+ fatalError ( " Failed to strip Windows path ' \( windowsPath) ': \( rStrip) " )
744
747
}
745
748
}
749
+ } else {
750
+ let errorCode = GetLastError ( )
751
+ fatalError ( " Failed to get the length of the system Windows directory path: \( errorCode) " )
746
752
}
747
753
748
754
// 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