authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-07-31 11:09:28-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-07-31 11:09:28-07:00
log5d345b69ea58eb159fbc97eb220e55ff9e30dee8
treebd322eba4c5864ff6abf910abdba9e6e0869a032
parenta048ddaf91b0316ac66ad22a7413f0f0d6f0f5f8

Revert "std.fs: selfExePath haiku using constants instead"

This reverts commit e21739dd8caf7d6a9aefe68c37eddb6406bcb810.

2 files changed, 4 insertions(+), 10 deletions(-)

lib/std/c/haiku.zig+2-9
...@@ -11,9 +11,9 @@ extern "c" fn _errnop() *c_int;...@@ -11,9 +11,9 @@ extern "c" fn _errnop() *c_int;
1111
12pub const _errno = _errnop;12pub const _errno = _errnop;
1313
14pub extern "c" fn find_directory(which: directory_which, volume: i32, createIt: bool, path_ptr: [*]u8, length: i32) status_t;14pub extern "c" fn find_directory(which: c_int, volume: i32, createIt: bool, path_ptr: [*]u8, length: i32) status_t;
1515
16pub extern "c" fn find_path(codePointer: *const u8, baseDirectory: path_base_directory, subPath: [*:0]const u8, pathBuffer: [*:0]u8, bufferSize: usize) status_t;16pub extern "c" fn find_path(codePointer: *const u8, baseDirectory: c_int, subPath: [*:0]const u8, pathBuffer: [*:0]u8, bufferSize: usize) status_t;
1717
18pub extern "c" fn find_thread(thread_name: ?*anyopaque) i32;18pub extern "c" fn find_thread(thread_name: ?*anyopaque) i32;
1919
...@@ -1024,13 +1024,6 @@ pub const directory_which = enum(c_int) {...@@ -1024,13 +1024,6 @@ pub const directory_which = enum(c_int) {
1024 _,1024 _,
1025};1025};
10261026
1027// TODO fill out if needed
1028pub const path_base_directory = enum(c_int) {
1029 B_FIND_PATH_IMAGE_PATH = 1000,
1030};
1031
1032pub const B_APP_IMAGE_SYMBOL = null;
1033
1034pub const cc_t = u8;1027pub const cc_t = u8;
1035pub const speed_t = u8;1028pub const speed_t = u8;
1036pub const tcflag_t = u32;1029pub const tcflag_t = u32;
lib/std/fs.zig+2-1
...@@ -3017,7 +3017,8 @@ pub fn selfExePath(out_buffer: []u8) SelfExePathError![]u8 {...@@ -3017,7 +3017,8 @@ pub fn selfExePath(out_buffer: []u8) SelfExePathError![]u8 {
3017 .haiku => {3017 .haiku => {
3018 // The only possible issue when looking for the self image path is3018 // The only possible issue when looking for the self image path is
3019 // when the buffer is too short.3019 // when the buffer is too short.
3020 if (os.find_path(os.B_APP_IMAGE_SYMBOL, os.path_base_directory.B_FIND_IMAGE_PATH, null, out_buffer.ptr, out_buffer.len) != 0)3020 // TODO replace with proper constants
3021 if (os.find_path(null, 1000, null, out_buffer.ptr, out_buffer.len) != 0)
3021 return error.Overflow;3022 return error.Overflow;
3022 return mem.sliceTo(out_buffer, 0);3023 return mem.sliceTo(out_buffer, 0);
3023 },3024 },