diff options
| author | castano <castano@gmail.com> | 2019-11-14 00:39:45 -0800 |
|---|---|---|
| committer | castano <castano@gmail.com> | 2019-11-14 00:50:26 -0800 |
| commit | 71d129a7093a54d1e2b6a0fb89b2e4dd514f88e3 (patch) | |
| tree | 08db16cade0a5cf8c10d86c0030fd8148715990f /src/build_settings.cpp | |
| parent | aa796a1032a3027c5d6d8af19e4834c4a60cb302 (diff) | |
Add support for running odin through a symlink. Use realpath when obtaining root dir.
Diffstat (limited to 'src/build_settings.cpp')
| -rw-r--r-- | src/build_settings.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/build_settings.cpp b/src/build_settings.cpp index 1f259205a..c02665215 100644 --- a/src/build_settings.cpp +++ b/src/build_settings.cpp @@ -357,6 +357,8 @@ String odin_root_dir(void) { #include <mach-o/dyld.h> +String path_to_fullpath(gbAllocator a, String s); + String odin_root_dir(void) { String path = global_module_path; isize len, i; @@ -390,7 +392,8 @@ String odin_root_dir(void) { text = gb_alloc_array(string_buffer_allocator, u8, len + 1); gb_memmove(text, &path_buf[0], len); - path = make_string(text, len); + path = path_to_fullpath(heap_allocator(), make_string(text, len)); + for (i = path.len-1; i >= 0; i--) { u8 c = path[i]; if (c == '/' || c == '\\') { @@ -451,7 +454,7 @@ String odin_root_dir(void) { gb_memmove(text, &path_buf[0], len); - path = make_string(text, len); + path = path_to_fullpath(heap_allocator(), make_string(text, len)); for (i = path.len-1; i >= 0; i--) { u8 c = path[i]; if (c == '/' || c == '\\') { |