Skip to content

Commit 4b2501c

Browse files
committed
Foundation: map ECANCELED properly for Windows
This is generally not a very helpful constant for Windows, however, it can be passed from Dispatch in some cases. Lets just provide the mapping for the Windows version.
1 parent 3eda66b commit 4b2501c

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

Sources/Foundation/NSError.swift

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1313,10 +1313,16 @@ extension POSIXError {
13131313
public static var EBADMACHO: POSIXError.Code { return .EBADMACHO }
13141314
#endif
13151315

1316-
#if !os(Windows)
13171316
/// Operation canceled.
1318-
public static var ECANCELED: POSIXError.Code { return .ECANCELED }
1317+
public static var ECANCELED: POSIXError.Code {
1318+
#if os(Windows)
1319+
return POSIXError.Code(rawValue: WinSDK.ECANCELED)!
1320+
#else
1321+
return .ECANCELED
1322+
#endif
1323+
}
13191324

1325+
#if !os(Windows)
13201326
/// Identifier removed.
13211327
public static var EIDRM: POSIXError.Code { return .EIDRM }
13221328

0 commit comments

Comments
 (0)