diff options
| author | gingerBill <bill@gingerbill.org> | 2024-06-20 12:15:55 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2024-06-20 12:15:55 +0100 |
| commit | c9884906d9aa06de407bd32c188230f07201d638 (patch) | |
| tree | 03f697633023d97edb51da6e2753dc6ea4c0214d /src/check_expr.cpp | |
| parent | 5dc98336a82463df6df9be1ff4bd2946f833b57b (diff) | |
Add `#directory`
Diffstat (limited to 'src/check_expr.cpp')
| -rw-r--r-- | src/check_expr.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/check_expr.cpp b/src/check_expr.cpp index a605957bb..cddcc05f2 100644 --- a/src/check_expr.cpp +++ b/src/check_expr.cpp @@ -8327,6 +8327,14 @@ gb_internal ExprKind check_basic_directive_expr(CheckerContext *c, Operand *o, A } o->type = t_untyped_string; o->value = exact_value_string(file); + } else if (name == "directory") { + String file = get_file_path_string(bd->token.pos.file_id); + String path = dir_from_path(file); + if (build_context.obfuscate_source_code_locations) { + path = obfuscate_string(path, "D"); + } + o->type = t_untyped_string; + o->value = exact_value_string(path); } else if (name == "line") { i32 line = bd->token.pos.line; if (build_context.obfuscate_source_code_locations) { |