Skip to content

Commit 2eafc21

Browse files
committed
feat: windows setup binary now installs latest zig
1 parent 4671635 commit 2eafc21

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

src/zigverm-setup/main.zig

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,14 @@ pub fn main() !void {
124124
try writeFilesFromZip(bin_dir, zipfile, zig_path);
125125

126126
std.log.info("Installed zigverm successfully", .{});
127+
128+
std.log.info("Installing latest stable zig version...", .{});
129+
const installed_binary = try path.join(allocator, &.{ zigverm_dir_path, "bin", "zigverm.exe" });
130+
var child = std.process.Child.init(&.{ installed_binary, "install", "stable" }, allocator);
131+
child.stdin = std.fs.File.stdin();
132+
child.stdout = std.fs.File.stdout();
133+
child.stderr = std.fs.File.stderr();
134+
_ = try child.spawnAndWait();
127135
}
128136

129137
fn writeFilesFromZip(bin_dir: std.fs.Dir, zipFile: ZipArchive, filename: []const u8) !void {
@@ -137,7 +145,15 @@ fn writeFilesFromZip(bin_dir: std.fs.Dir, zipFile: ZipArchive, filename: []const
137145
try entry_ptr.decompressWriter(writer);
138146
}
139147

140-
fn download_tarball(alloc: std.mem.Allocator, client: *Client, io: Io, tb_url: []const u8, tb_writer: *std.fs.File.Writer, tarball_size: u64, total_size: usize) !void {
148+
fn download_tarball(
149+
alloc: std.mem.Allocator,
150+
client: *Client,
151+
io: Io,
152+
tb_url: []const u8,
153+
tb_writer: *std.fs.File.Writer,
154+
tarball_size: u64,
155+
total_size: usize,
156+
) !void {
141157
std.log.info("Downloading {s}", .{tb_url});
142158
const tarball_uri = try std.Uri.parse(tb_url);
143159

0 commit comments

Comments
 (0)