[core/os] get_current_directory: Add allocator arg to targets where its missing

This commit is contained in:
Yuriy Grynevych
2024-09-18 21:03:48 +03:00
parent 8814170edf
commit 4ff836609c
5 changed files with 5 additions and 5 deletions

View File

@@ -1095,7 +1095,7 @@ unset_env :: proc(key: string) -> Error {
}
@(require_results)
get_current_directory :: proc() -> string {
get_current_directory :: proc(allocator := context.allocator) -> string {
page_size := get_page_size() // NOTE(tetra): See note in os_linux.odin/get_current_directory.
buf := make([dynamic]u8, page_size)
for {

View File

@@ -840,7 +840,7 @@ get_env :: proc(key: string, allocator := context.allocator) -> (value: string)
}
@(require_results)
get_current_directory :: proc() -> string {
get_current_directory :: proc(allocator := context.allocator) -> string {
// NOTE(tetra): I would use PATH_MAX here, but I was not able to find
// an authoritative value for it across all systems.
// The largest value I could find was 4096, so might as well use the page size.

View File

@@ -985,7 +985,7 @@ unset_env :: proc(key: string) -> Error {
}
@(require_results)
get_current_directory :: proc() -> string {
get_current_directory :: proc(allocator := context.allocator) -> string {
// NOTE(tetra): I would use PATH_MAX here, but I was not able to find
// an authoritative value for it across all systems.
// The largest value I could find was 4096, so might as well use the page size.

View File

@@ -894,7 +894,7 @@ get_env :: proc(key: string, allocator := context.allocator) -> (value: string)
}
@(require_results)
get_current_directory :: proc() -> string {
get_current_directory :: proc(allocator := context.allocator) -> string {
// NOTE(tetra): I would use PATH_MAX here, but I was not able to find
// an authoritative value for it across all systems.
// The largest value I could find was 4096, so might as well use the page size.

View File

@@ -806,7 +806,7 @@ get_env :: proc(key: string, allocator := context.allocator) -> (value: string)
}
@(require_results)
get_current_directory :: proc() -> string {
get_current_directory :: proc(allocator := context.allocator) -> string {
buf := make([dynamic]u8, MAX_PATH)
for {
cwd := _unix_getcwd(cstring(raw_data(buf)), c.size_t(len(buf)))