feature. See also
. The project being documented here (as the example) is the Zig library itself.
LibCInstallation.findNativeMsvcIncludeDir
fn findNativeMsvcIncludeDir(
self: *LibCInstallation,
gpa: Allocator,
io: Io,
sdk: std.zig.WindowsSdk,
) FindError!void
File
Code
fn findNativeMsvcIncludeDir(
self: *LibCInstallation,
gpa: Allocator,
io: Io,
sdk: std.zig.WindowsSdk,
) FindError!void {
const msvc_lib_dir = sdk.msvc_lib_dir orelse return error.LibCStdLibHeaderNotFound;
const up1 = fs.path.dirname(msvc_lib_dir) orelse return error.LibCStdLibHeaderNotFound;
const up2 = fs.path.dirname(up1) orelse return error.LibCStdLibHeaderNotFound;
const dir_path = try fs.path.join(gpa, &[_][]const u8{ up2, "include" });
errdefer gpa.free(dir_path);
var dir = Io.Dir.cwd().openDir(io, dir_path, .{}) catch |err| switch (err) {
error.FileNotFound,
error.NotDir,
error.NoDevice,
=> return error.LibCStdLibHeaderNotFound,
else => return error.FileSystem,
};
defer dir.close(io);
dir.access(io, "vcruntime.h", .{}) catch |err| switch (err) {
error.FileNotFound => return error.LibCStdLibHeaderNotFound,
else => return error.FileSystem,
};
self.sys_include_dir = dir_path;
}