Skip to content

Commit e9d8347

Browse files
authored
Merge pull request swiftlang#2887 from compnerd/cancelled
Foundation: map `ECANCELED` properly for Windows
2 parents fd7c1e9 + 7e9c243 commit e9d8347

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

Sources/Foundation/NSError.swift

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -995,6 +995,14 @@ extension POSIXErrorCode: _ErrorCodeProtocol {
995995
public typealias _ErrorType = POSIXError
996996
}
997997

998+
#if os(Windows)
999+
extension POSIXErrorCode {
1000+
public static var ECANCELED: POSIXErrorCode {
1001+
return POSIXError.Code(rawValue: WinSDK.ECANCELED)!
1002+
}
1003+
}
1004+
#endif
1005+
9981006
extension POSIXError {
9991007
/// Operation not permitted.
10001008
public static var EPERM: POSIXError.Code { return .EPERM }
@@ -1313,10 +1321,10 @@ extension POSIXError {
13131321
public static var EBADMACHO: POSIXError.Code { return .EBADMACHO }
13141322
#endif
13151323

1316-
#if !os(Windows)
13171324
/// Operation canceled.
13181325
public static var ECANCELED: POSIXError.Code { return .ECANCELED }
13191326

1327+
#if !os(Windows)
13201328
/// Identifier removed.
13211329
public static var EIDRM: POSIXError.Code { return .EIDRM }
13221330

0 commit comments

Comments
 (0)