From 5d345b69ea58eb159fbc97eb220e55ff9e30dee8 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Mon, 31 Jul 2023 11:09:28 -0700 Subject: [PATCH] Revert "std.fs: selfExePath haiku using constants instead" This reverts commit e21739dd8caf7d6a9aefe68c37eddb6406bcb810. --- lib/std/c/haiku.zig | 11 ++--------- lib/std/fs.zig | 3 ++- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/lib/std/c/haiku.zig b/lib/std/c/haiku.zig index e8e5ac70e0..49d1c06264 100644 --- a/lib/std/c/haiku.zig +++ b/lib/std/c/haiku.zig @@ -11,9 +11,9 @@ extern "c" fn _errnop() *c_int; pub const _errno = _errnop; -pub extern "c" fn find_directory(which: directory_which, volume: i32, createIt: bool, path_ptr: [*]u8, length: i32) status_t; +pub extern "c" fn find_directory(which: c_int, volume: i32, createIt: bool, path_ptr: [*]u8, length: i32) status_t; -pub extern "c" fn find_path(codePointer: *const u8, baseDirectory: path_base_directory, subPath: [*:0]const u8, pathBuffer: [*:0]u8, bufferSize: usize) status_t; +pub extern "c" fn find_path(codePointer: *const u8, baseDirectory: c_int, subPath: [*:0]const u8, pathBuffer: [*:0]u8, bufferSize: usize) status_t; pub extern "c" fn find_thread(thread_name: ?*anyopaque) i32; @@ -1024,13 +1024,6 @@ pub const directory_which = enum(c_int) { _, }; -// TODO fill out if needed -pub const path_base_directory = enum(c_int) { - B_FIND_PATH_IMAGE_PATH = 1000, -}; - -pub const B_APP_IMAGE_SYMBOL = null; - pub const cc_t = u8; pub const speed_t = u8; pub const tcflag_t = u32; diff --git a/lib/std/fs.zig b/lib/std/fs.zig index de18a085e4..3ab88f080f 100644 --- a/lib/std/fs.zig +++ b/lib/std/fs.zig @@ -3017,7 +3017,8 @@ pub fn selfExePath(out_buffer: []u8) SelfExePathError![]u8 { .haiku => { // The only possible issue when looking for the self image path is // when the buffer is too short. - 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) + // TODO replace with proper constants + if (os.find_path(null, 1000, null, out_buffer.ptr, out_buffer.len) != 0) return error.Overflow; return mem.sliceTo(out_buffer, 0); },