Skip to content

Commit ee6fb42

Browse files
committed
SWBWindowsPlatform: make the module build on Windows
`KF_KNOWN_FOLDER` is a strongly typed enumerator and does not import into Swift as an integral type. Provide a local overload to allow writing the code idiomatically. `SUCCEEDED` is a "complex" macro that is beyond the ability of the ClangImporter to import into Swift. Provide a trivial implementation of the CPP macro in Swift to allow writing code idiomatically.
1 parent 9dd4378 commit ee6fb42

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Sources/SWBWindowsPlatform/KnownFolders.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,14 @@ import Foundation
1616
#if os(Windows)
1717
import WinSDK
1818

19+
private var KF_FLAG_DEFAULT: DWORD {
20+
DWORD(WinSDK.KF_FLAG_DEFAULT.rawValue)
21+
}
22+
23+
private func SUCCEEDED(_ hr: HRESULT) -> Bool {
24+
hr >= 0
25+
}
26+
1927
private func _url(for id: KNOWNFOLDERID) -> URL? {
2028
var pszPath: PWSTR?
2129
let hr: HRESULT = withUnsafePointer(to: id) { id in

0 commit comments

Comments
 (0)