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 › Threaded › processSetCurrentDir Private Function processSetCurrentDir Doc Source Private Function std.Io.Threaded.processSetCurrentDir
fn processSetCurrentDir (userdata : ?*anyopaque , dir : Dir ) process .SetCurrentDirError !void Params userdata : ?*anyopaque dir : Dir File Io/Threaded.zig: 14185
14185
14186
14187
14188
14189
14190
14191
14192
14193
14194
14195
14196
14197
14198
14199
14200
14201
14202
14203
14204
14205
14206
14207
14208
14209
14210
14211
14212
14213
14214 fn processSetCurrentDir (userdata : ?*anyopaque , dir : Dir ) process .SetCurrentDirError !void {
const t : *Threaded = @ptrCast (@alignCast (userdata ));
_ = t ;
if (native_os == .wasi ) return error .OperationUnsupported ;
if (is_windows ) {
var dir_path_buf : [windows .PATH_MAX_WIDE ]u16 = undefined ;
const dir_path = try GetFinalPathNameByHandle (dir .handle , .{}, &dir_path_buf );
const syscall : Syscall = try .start ();
while (true ) switch (windows .ntdll .RtlSetCurrentDirectory_U (&.init (dir_path ))) {
.SUCCESS => return syscall .finish (),
.OBJECT_NAME_INVALID => return syscall .fail (error .BadPathName ),
.OBJECT_NAME_NOT_FOUND => return syscall .fail (error .FileNotFound ),
.OBJECT_PATH_NOT_FOUND => return syscall .fail (error .FileNotFound ),
.NO_MEDIA_IN_DEVICE => return syscall .fail (error .NoDevice ),
.INVALID_PARAMETER => |err | return syscall .ntstatusBug (err ),
.ACCESS_DENIED => return syscall .fail (error .AccessDenied ),
.OBJECT_PATH_SYNTAX_BAD => |err | return syscall .ntstatusBug (err ),
.NOT_A_DIRECTORY => return syscall .fail (error .NotDir ),
.CANCELLED => {
try syscall .checkCancel ();
continue ;
},
else => |status | return syscall .unexpectedNtstatus (status ),
};
}
return fchdir (dir .handle );
}