Skip to content
← Back

src/driver/output_file_name_generator.ghul

1
namespace Driver is
2
use IO.Std;
3
4
5
class OUTPUT_FILE_NAME_GENERATOR() is
6
_current: string?;
7
8
result: string =>
9
if _current? then
10
_current
11
else
12
"binary.exe"
13
fi;
14
15
force(path: string) is
16
_current = path;
17
si
18
19
seen_file(path: string mut) is
20
if _current? then
21
return;
22
fi
23
24
if path.ends_with(".ghul") then
25
path = path.substring(0, path.length - 5);
26
let last_slash_index = path.last_index_of('/');
27
28
if last_slash_index >= 0 then
29
_current = path.substring(last_slash_index + 1);
30
else
31
_current = path;
32
fi
33
34
return;
35
fi
36
si
37
si
38
si