os/os2: add get_executable_path and get_executable_directory

This commit is contained in:
Laytan Laats
2025-01-21 18:54:45 +01:00
parent 223970671f
commit b673642412
10 changed files with 234 additions and 3 deletions
+12
View File
@@ -2,6 +2,8 @@ package os2
import "base:runtime"
import "core:path/filepath"
Path_Separator :: _Path_Separator // OS-Specific
Path_Separator_String :: _Path_Separator_String // OS-Specific
Path_List_Separator :: _Path_List_Separator // OS-Specific
@@ -39,3 +41,13 @@ setwd :: set_working_directory
set_working_directory :: proc(dir: string) -> (err: Error) {
return _set_working_directory(dir)
}
get_executable_path :: proc(allocator: runtime.Allocator) -> (path: string, err: Error) {
return _get_executable_path(allocator)
}
get_executable_directory :: proc(allocator: runtime.Allocator) -> (path: string, err: Error) {
path = _get_executable_path(allocator) or_return
path, _ = filepath.split(path)
return
}