We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
POSIXErrorCode
1 parent b6ca869 commit c25ca66Copy full SHA for c25ca66
Sources/FoundationEssentials/Error/CocoaError+FilePath.swift
@@ -94,7 +94,15 @@ extension CocoaError {
94
var userInfo = userInfo
95
96
// (130280235) POSIXError.Code does not have a case for EOPNOTSUPP
97
- if errno != EOPNOTSUPP {
+ let _EOPNOTSUPP: Int32
98
+ #if os(WASI)
99
+ // wasi-libc's errno.h constants cannot be directly imported into Swift
100
+ // so we use Swift stdlib's POSIXErrorCode instead
101
+ _EOPNOTSUPP = POSIXErrorCode.EOPNOTSUPP.rawValue
102
+ #else
103
+ _EOPNOTSUPP = EOPNOTSUPP
104
+ #endif
105
+ if errno != _EOPNOTSUPP {
106
guard let code = POSIXError.Code(rawValue: errno) else {
107
fatalError("Invalid posix errno \(errno)")
108
}
0 commit comments