diff --git a/Tests/WITExtractorTests/TestSupport.swift b/Tests/WITExtractorTests/TestSupport.swift index e4766929..a4ebd66d 100644 --- a/Tests/WITExtractorTests/TestSupport.swift +++ b/Tests/WITExtractorTests/TestSupport.swift @@ -47,9 +47,18 @@ struct TestSupport { let templatePath = tempdir.appendingPathComponent("WasmKit.XXXXXX") var template = [UInt8](templatePath.path.utf8).map({ Int8($0) }) + [Int8(0)] + #if os(Windows) + if _mktemp_s(&template, template.count) != 0 { + throw Error(errno: errno) + } + if _mkdir(template) != 0 { + throw Error(errno: errno) + } + #else if mkdtemp(&template) == nil { throw Error(errno: errno) } + #endif let path = String(cString: template) defer { _ = try? FileManager.default.removeItem(atPath: path) }