Skip to content

Commit f7300dc

Browse files
authored
Merge pull request #336 from swiftwasm/main
[pull] swiftwasm from main
2 parents c4122ff + 08f2025 commit f7300dc

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Sources/Foundation/FileManager+Win32.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,11 @@ extension FileManager {
269269
throw _NSErrorWithWindowsError(GetLastError(), reading: true, paths: [path])
270270
}
271271

272+
let hr: HRESULT = PathCchStripToRoot(&szVolumePath, szVolumePath.count)
273+
guard hr == S_OK || hr == S_FALSE else {
274+
throw _NSErrorWithWindowsError(DWORD(hr & 0xffff), reading: true, paths: [path])
275+
}
276+
272277
var volumeSerialNumber: DWORD = 0
273278
guard GetVolumeInformationW(&szVolumePath, nil, 0, &volumeSerialNumber, nil, nil, nil, 0) else {
274279
throw _NSErrorWithWindowsError(GetLastError(), reading: true, paths: [path])

0 commit comments

Comments
 (0)