Zig 0.17.0-dev (Split by item) This is an example of documentation generated by
ZigDoc , an alternative to Zig's built-in
Auto Doc feature. See also
examples in other modes/formats . The project being documented here (as the example) is the Zig standard library.
std › Io › Dispatch › processExecutablePath Private Function processExecutablePath Doc Source Private Function std.Io.Dispatch.processExecutablePath
fn processExecutablePath (userdata : ?*anyopaque , out_buffer : []u8 ) process .ExecutablePathError !usize Params userdata : ?*anyopaque out_buffer : []u8 File Io/Dispatch.zig: 3955
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970 fn processExecutablePath (userdata : ?*anyopaque , out_buffer : []u8 ) process .ExecutablePathError !usize {
const ev : *Evented = @ptrCast (@alignCast (userdata ));
// _NSGetExecutablePath() returns a path that might be a symlink to
// the executable.
var symlink_path_buf : [c .PATH_MAX + 1 ]u8 = undefined ;
var n : u32 = symlink_path_buf .len ;
const rc = c ._NSGetExecutablePath (&symlink_path_buf , &n );
if (rc != 0 ) return error .NameTooLong ;
const symlink_path = std .mem .sliceTo (&symlink_path_buf , 0 );
assert (Dir .path .isAbsolute (symlink_path ));
return dirRealPathFile (ev , .cwd (), symlink_path , out_buffer ) catch |err | switch (err ) {
error .NetworkNotFound => unreachable , // Windows-only
error .FileBusy => unreachable , // Windows-only
else => |e | return e ,
};
}