Commit 5d345b69ea

Andrew Kelley <andrew@ziglang.org>
2023-07-31 20:09:28
Revert "std.fs: selfExePath haiku using constants instead"
This reverts commit e21739dd8caf7d6a9aefe68c37eddb6406bcb810.
1 parent a048dda
Changed files (2)
lib
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;
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);
         },