aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2018-03-03 10:23:27 +0000
committergingerBill <bill@gingerbill.org>2018-03-03 10:23:27 +0000
commit63ab8b241866d2e7d12445f2cd95db3f808e0c7b (patch)
tree695c81a3a0691e56566f4dbd5d04ac78615703ba /src
parent40542e6e2606f9370ce19755ee704ffb24c8921e (diff)
Make irGen.output_base use full path rather than relative
Diffstat (limited to 'src')
-rw-r--r--src/common.cpp9
-rw-r--r--src/ir.cpp4
2 files changed, 12 insertions, 1 deletions
diff --git a/src/common.cpp b/src/common.cpp
index 58597a9fc..354750a24 100644
--- a/src/common.cpp
+++ b/src/common.cpp
@@ -692,3 +692,12 @@ wchar_t **command_line_to_wargv(wchar_t *cmd_line, int *_argc) {
}
#endif
+
+String path_to_full_path(gbAllocator a, String path) {
+ gbAllocator ha = heap_allocator();
+ char *path_c = gb_alloc_str_len(ha, cast(char *)path.text, path.len);
+ defer (gb_free(ha, path_c));
+
+ char *fullpath = gb_path_get_full_name(a, path_c);
+ return make_string_c(fullpath);
+}
diff --git a/src/ir.cpp b/src/ir.cpp
index c4fbf23a6..5b488c403 100644
--- a/src/ir.cpp
+++ b/src/ir.cpp
@@ -7766,8 +7766,10 @@ bool ir_gen_init(irGen *s, Checker *c) {
s->output_base = substring(s->output_name, 0, pos);
}
}
+ gbAllocator ha = heap_allocator();
+ s->output_base = path_to_full_path(ha, s->output_base);
- gbString output_file_path = gb_string_make_length(heap_allocator(), s->output_base.text, s->output_base.len);
+ gbString output_file_path = gb_string_make_length(ha, s->output_base.text, s->output_base.len);
output_file_path = gb_string_appendc(output_file_path, ".ll");
defer (gb_string_free(output_file_path));