File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change 1+ #if os(WASI)
2+ import Foundation
3+ import WASILibc
4+
5+
6+
7+ typealias Pipe = FakePipe
8+ struct FakePipe {
9+
10+ init ( ) {
11+ try ! Data ( ) . write ( to: fileURL)
12+ assert ( FileManager . default. fileExists ( atPath: fileURL. absoluteURL. path) , " Created file does not exist! " )
13+ }
14+
15+ var fileHandleForWriting : FileHandle {
16+ return try ! FileHandle ( forWritingTo: fileURL)
17+ }
18+
19+ var fileHandleForReading : FileHandle {
20+ return try ! FileHandle ( forReadingFrom: fileURL)
21+ }
22+
23+ private let fileURL = FileManager . default. temporaryDirectory. appendingPathComponent ( " json-logger-test- \( UUID ( ) ) .txt " )
24+ // private let fileURL = URL(fileURLWithPath: #filePath).deletingLastPathComponent().appendingPathComponent("json-logger-test-\(UUID()).txt")
25+ private var filepath : String {
26+ fileURL. absoluteURL. path
27+ }
28+
29+ }
30+ #endif
You can’t perform that action at this time.
0 commit comments