-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathpaths.d
43 lines (39 loc) · 813 Bytes
/
paths.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
43
import std.file;
import std.path;
import std.process;
import std.range;
import std.stdio;
import linker;
class Paths
{
string[] paths;
void add(string path)
{
if (path.length >= 2 &&
path[0] == '"' &&
path[$-1] == '"')
path = path[1..$-1];
paths ~= path;
if (verbosity)
writefln("verbose: Include Path \"%s\"", path);
}
void addLINK()
{
foreach(p; environment.get("LINK").split(";"))
if (p)
add(p);
}
bool search(ref string file)
{
foreach(path; paths)
{
auto p = buildPath(path, file);
if (exists(p))
{
file = p;
return true;
}
}
return false;
}
}