diff --git a/Sources/Foundation/NSPathUtilities.swift b/Sources/Foundation/NSPathUtilities.swift index 1726b35115..e39408c136 100644 --- a/Sources/Foundation/NSPathUtilities.swift +++ b/Sources/Foundation/NSPathUtilities.swift @@ -10,6 +10,15 @@ @_implementationOnly import CoreFoundation #if os(Windows) import WinSDK +#elseif os(WASI) +import WASILibc +// CoreFoundation brings but it conflicts with WASILibc.errno +// definition, so we need to explicitly select the one from WASILibc. +// This is defined as "internal" since this workaround also used in other files. +internal var errno: Int32 { + get { WASILibc.errno } + set { WASILibc.errno = newValue } +} #endif #if os(Windows)