Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion Sources/Foundation/NSPathUtilities.swift
Original file line number Diff line number Diff line change
Expand Up @@ -779,6 +779,10 @@ internal func _NSCreateTemporaryFile(_ filePath: String) throws -> (Int32, Strin
}
// Don't close h, fd is transferred ownership
let fd = _open_osfhandle(intptr_t(bitPattern: h), 0)
return (fd, pathResult)
#elseif os(WASI)
// WASI does not have temp directories
throw NSError(domain: NSPOSIXErrorDomain, code: Int(ENOTSUP))
#else
var template = URL(fileURLWithPath: filePath)

Expand Down Expand Up @@ -814,8 +818,8 @@ internal func _NSCreateTemporaryFile(_ filePath: String) throws -> (Int32, Strin
close(fd)
throw _NSErrorWithErrno(_errno, reading: false, path: pathResult)
}
#endif
return (fd, pathResult)
#endif
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this change seems to be impacting non-WASI #if branch?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The return (fd, pathResult) line was shared among all cases, but it's now cloned into os(Windows) and !os(Windows) && !os(WASI) cases. So there is no semantic change.

}

internal func _NSCleanupTemporaryFile(_ auxFilePath: String, _ filePath: String) throws {
Expand Down