authorgravatar for devnexen@gmail.comDavid Carlier <devnexen@gmail.com> 2023-04-24 20:35:51+01:00
committergravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2023-04-24 22:41:44+03:00
log7439eb5e99ba98bbdb2a0d0d71535e57d13f3c6e
tree34aff3dc6b2874a9cc616d9d7e84d6db3eb5210d
parentdc9472964325743e3f9e7f3cedfb942b5f44ad14

std.os: selfExePath implementation for haiku


1 files changed, 10 insertions(+), 1 deletions(-)

lib/std/fs.zig+10-1
......@@ -2913,6 +2913,7 @@ pub const OpenSelfExeError = error{
29132913 /// On Windows, file paths cannot contain these characters:
29142914 /// '/', '*', '?', '"', '<', '>', '|'
29152915 BadPathName,
2916 Overflow,
29162917 Unexpected,
29172918} || os.OpenError || SelfExePathError || os.FlockError;
29182919
......@@ -2991,7 +2992,15 @@ pub fn selfExePath(out_buffer: []u8) SelfExePathError![]u8 {
29912992 // TODO could this slice from 0 to out_len instead?
29922993 return mem.sliceTo(out_buffer, 0);
29932994 },
2994 .openbsd, .haiku => {
2995 .haiku => {
2996 // The only possible issue when looking for the self image path is
2997 // when the buffer is too short.
2998 // TODO replace with proper constants
2999 if (os.find_path(null, 1000, null, out_buffer.ptr, out_buffer.len) != 0)
3000 return error.Overflow;
3001 return mem.sliceTo(out_buffer, 0);
3002 },
3003 .openbsd => {
29953004 // OpenBSD doesn't support getting the path of a running process, so try to guess it
29963005 if (os.argv.len == 0)
29973006 return error.FileNotFound;