Skip to content

Commit 0b4f13f

Browse files
Fix WASI build of _copyDirectoryMetadata (#1094)
Extended attributes don't exist in WASI, so we need to exclude the use of xattr-related APIs including `flistxattr`.
1 parent 309d460 commit 0b4f13f

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

Sources/FoundationEssentials/FileManager/FileOperations.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -951,6 +951,7 @@ enum _FileOperations {
951951

952952
#if !canImport(Darwin)
953953
private static func _copyDirectoryMetadata(srcFD: CInt, srcPath: @autoclosure () -> String, dstFD: CInt, dstPath: @autoclosure () -> String, delegate: some LinkOrCopyDelegate) throws {
954+
#if !os(WASI)
954955
// Copy extended attributes
955956
var size = flistxattr(srcFD, nil, 0)
956957
if size > 0 {
@@ -976,6 +977,7 @@ enum _FileOperations {
976977
}
977978
}
978979
}
980+
#endif
979981
var statInfo = stat()
980982
if fstat(srcFD, &statInfo) == 0 {
981983
// Copy owner/group

0 commit comments

Comments
 (0)