diff options
| author | Bradley Lewis <22850972+BradLewis@users.noreply.github.com> | 2025-10-17 16:04:55 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-10-17 16:04:55 -0400 |
| commit | e37118506e02e2d081e93b57a79bda85bfab2343 (patch) | |
| tree | c39dc46fe7b03ceba47b6bc57d5bf7994fdcfcad | |
| parent | a1f22363a2c61ae5ce4de6ef31d561317b0e45d0 (diff) | |
| parent | 54d444da21020a19f4074a0a6b4bf768e985449a (diff) | |
Merge pull request #1105 from KamWithK/master
os2 fixes getting executable path fail
| -rw-r--r-- | src/common/util.odin | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/common/util.odin b/src/common/util.odin index 94348fb..974fe6b 100644 --- a/src/common/util.odin +++ b/src/common/util.odin @@ -5,6 +5,7 @@ import "core:fmt" import "core:log" import "core:mem" import "core:os" +import "core:os/os2" import "core:path/filepath" import "core:path/slashpath" import "core:strings" @@ -126,12 +127,13 @@ when ODIN_OS == .Darwin || ODIN_OS == .FreeBSD || ODIN_OS == .Linux || ODIN_OS = } get_executable_path :: proc(allocator := context.temp_allocator) -> string { - exe_path, ok := filepath.abs(os.args[0], context.temp_allocator) + exe_dir, err := os2.get_executable_directory(context.temp_allocator) - if !ok { - log.error("Failed to resolve executable path") + if err != nil { + log.error("Failed to resolve executable path: ", err) return "" } - return filepath.dir(exe_path, allocator) + return exe_dir } + |