Skip to content

Commit 4784ffb

Browse files
[wasm] Fix CocoaError construction for unsupported copy/link operations (#944)
This is a follow-up fix for 6c0a3e8, which re-organized CocoaError helper functions.
1 parent 5388f1e commit 4784ffb

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Sources/FoundationEssentials/FileManager/FileOperations.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -920,10 +920,11 @@ enum _FileOperations {
920920
try delegate.throwIfNecessary(errno, src, dst)
921921
return
922922
}
923+
let copyFile = delegate.copyData
923924
guard !stat.isDirectory else {
924925
// wasi-libc does not support FTS for now, so we don't support copying/linking
925926
// directories on WASI for now.
926-
let error = CocoaError.fileOperationError(.featureUnsupported, src, dst)
927+
let error = CocoaError.errorWithFilePath(.featureUnsupported, src, variant: copyFile ? "Copy" : "Link", source: src, destination: dst)
927928
try delegate.throwIfNecessary(error, src, dst)
928929
return
929930
}
@@ -943,7 +944,7 @@ enum _FileOperations {
943944
try delegate.throwIfNecessary(errno, src, dst)
944945
}
945946
} else {
946-
if delegate.copyData {
947+
if copyFile {
947948
try _copyRegularFile(srcPtr, dstPtr, delegate: delegate)
948949
} else {
949950
if link(srcPtr, dstPtr) != 0 {

0 commit comments

Comments
 (0)