mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 15:48:51 +00:00
Merge pull request #476 from castano/symlink-fix
Add support for running odin through a symlink.
This commit is contained in:
@@ -357,6 +357,8 @@ String odin_root_dir(void) {
|
|||||||
|
|
||||||
#include <mach-o/dyld.h>
|
#include <mach-o/dyld.h>
|
||||||
|
|
||||||
|
String path_to_fullpath(gbAllocator a, String s);
|
||||||
|
|
||||||
String odin_root_dir(void) {
|
String odin_root_dir(void) {
|
||||||
String path = global_module_path;
|
String path = global_module_path;
|
||||||
isize len, i;
|
isize len, i;
|
||||||
@@ -390,7 +392,8 @@ String odin_root_dir(void) {
|
|||||||
text = gb_alloc_array(string_buffer_allocator, u8, len + 1);
|
text = gb_alloc_array(string_buffer_allocator, u8, len + 1);
|
||||||
gb_memmove(text, &path_buf[0], len);
|
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--) {
|
for (i = path.len-1; i >= 0; i--) {
|
||||||
u8 c = path[i];
|
u8 c = path[i];
|
||||||
if (c == '/' || c == '\\') {
|
if (c == '/' || c == '\\') {
|
||||||
@@ -412,6 +415,8 @@ String odin_root_dir(void) {
|
|||||||
// NOTE: Linux / Unix is unfinished and not tested very well.
|
// NOTE: Linux / Unix is unfinished and not tested very well.
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
|
String path_to_fullpath(gbAllocator a, String s);
|
||||||
|
|
||||||
String odin_root_dir(void) {
|
String odin_root_dir(void) {
|
||||||
String path = global_module_path;
|
String path = global_module_path;
|
||||||
isize len, i;
|
isize len, i;
|
||||||
@@ -451,7 +456,7 @@ String odin_root_dir(void) {
|
|||||||
|
|
||||||
gb_memmove(text, &path_buf[0], len);
|
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--) {
|
for (i = path.len-1; i >= 0; i--) {
|
||||||
u8 c = path[i];
|
u8 c = path[i];
|
||||||
if (c == '/' || c == '\\') {
|
if (c == '/' || c == '\\') {
|
||||||
|
|||||||
Reference in New Issue
Block a user