-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathio.d
43 lines (41 loc) · 955 Bytes
/
io.d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
module util.io;
version(WASM){
struct StdOut{
static:
void write(T...)(auto ref T args){}
void writeln(T...)(auto ref T args){}
void writefln(T...)(auto ref T args){}
void flush(){}
};
StdOut stdout;
bool isATTy(StdOut){ return false; }
static struct StdErr{
static:
void write(T...)(auto ref T args){}
void writeln(T...)(auto ref T args){}
void writefln(T...)(auto ref T args){}
static void flush(){}
}
StdErr stderr;
bool isATTy(StdErr){ return false; }
struct File{
string path;
string readln(){ return ""; }
string[] byChunk(int n){ return []; }
}
void writeln(T...)(auto ref T args){
stdout.writeln(forward!args);
}
void writefln(T...)(auto ref T args){
stdout.writefln(forward!args);
}
static struct file{
static:
@property string thisExePath(){ return "."; }
bool exists(string name){ return true; }
}
}else{
public import std.stdio;
public import file=std.file;
}
import core.lifetime:forward;