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. Private Function
fnfindInstancesDir(
gpa: Allocator,
io: Io,
registry: *Registry,
environ_map: *constEnviron.Map,
) error{ OutOfMemory, PathNotFound }!Dir {
// First, try getting the packages cache path from the registry.// This only seems to exist when the path is different from the default.method1: {
returnfindInstancesDirViaSetup(gpa, io, registry) catch |err| switch (err) {
error.OutOfMemory => |e| returne,
error.PathNotFound => break :method1,
};
}
// Otherwise, try to get the path from the .dll that would have been// loaded via COM for SetupConfiguration.method2: {
returnfindInstancesDirViaCLSID(gpa, io, registry) catch |err| switch (err) {
error.OutOfMemory => |e| returne,
error.PathNotFound => break :method2,
};
}
// If that can't be found, fall back to manually appending// `Microsoft\VisualStudio\Packages\_Instances` to %PROGRAMDATA%method3: {
constprogram_data = std.zig.EnvVar.PROGRAMDATA.get(environ_map) orelsebreak :method3;
if (!std.fs.path.isAbsolute(program_data)) break :method3;
constinstances_path = tryDir.path.join(gpa, &.{
program_data, "Microsoft", "VisualStudio", "Packages", "_Instances",
});
defergpa.free(instances_path);
returnDir.openDirAbsolute(io, instances_path, .{ .iterate = true }) catchbreak :method3;
}
returnerror.PathNotFound;
}