diff options
| author | DanielGavin <danielgavin5@hotmail.com> | 2024-05-29 21:40:01 +0200 |
|---|---|---|
| committer | DanielGavin <danielgavin5@hotmail.com> | 2024-05-29 21:40:01 +0200 |
| commit | 2219138b240d0b8d8e71601b7852f666df316fea (patch) | |
| tree | a551ecb0c420e60a4544e3bc483512345fa933be /src/common | |
| parent | 9cf3c6313e77b0c3d80b8ffc298b20ab2d5b633d (diff) | |
More work on renaming
Diffstat (limited to 'src/common')
| -rw-r--r-- | src/common/util.odin | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/common/util.odin b/src/common/util.odin index 784a193..0968494 100644 --- a/src/common/util.odin +++ b/src/common/util.odin @@ -6,6 +6,7 @@ import "core:log" import "core:mem" import "core:os" import "core:path/filepath" +import "core:path/slashpath" import "core:strings" foreign import libc "system:c" @@ -120,3 +121,14 @@ when ODIN_OS == .Darwin || ODIN_OS == .Linux { fgetc :: proc "cdecl" (stream: ^FILE) -> i32 --- } } + +get_executable_path :: proc(allocator := context.temp_allocator) -> string { + exe_path, ok := filepath.abs( + slashpath.dir(os.args[0], context.temp_allocator), + ) + if !ok { + log.error("Failed to resolve executable path") + return "" + } + return exe_path +} |