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 › os › windows › normalizePath Public Function normalizePath Doc Source Public Function std.os.windows.normalizePath
pub fn normalizePath (comptime T : type , path : []T ) RemoveDotDirsError !usize Params Errors File os/windows.zig: 3843
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855 pub fn normalizePath (comptime T : type , path : []T ) RemoveDotDirsError !usize {
mem .replaceScalar (T , path , '/' , '\\' );
const new_len = mem .collapseRepeatsLen (T , path , '\\' );
const prefix_len : usize = init : {
if (new_len >= 1 and path [0 ] == '\\' ) break :init 1 ;
if (new_len >= 2 and path [1 ] == ':' )
break :init if (new_len >= 3 and path [2 ] == '\\' ) @as (usize , 3 ) else @as (usize , 2 );
break :init 0 ;
};
return prefix_len + try removeDotDirsSanitized (T , path [prefix_len ..new_len ]);
}
Normalizes a Windows path with the following steps: