Browse Source

upgrade zarc

Jonathan Marler 3 years ago
parent
commit
c59812afa4
2 changed files with 7 additions and 8 deletions
  1. 1 1
      build.zig
  2. 6 7
      zigup.zig

+ 1 - 1
build.zig

@@ -107,7 +107,7 @@ fn addZigupExe(
         const zarc_repo = GitRepoStep.create(b, .{
             .url = "https://github.com/SuperAuguste/zarc",
             .branch = null,
-            .sha = "accc35c0bf190d55133cc689cf989c03bf853349",
+            .sha = "2a8fd27baa781b9de821b1b4e0b89283413054b8",
         });
         exe.step.dependOn(&zarc_repo.step);
         const zarc_repo_path = zarc_repo.getPath(&exe.step);

+ 6 - 7
zigup.zig

@@ -683,15 +683,14 @@ fn installCompiler(allocator: *Allocator, compiler_dir: []const u8, url: []const
 
                     var installing_dir_opened = try std.fs.openDirAbsolute(installing_dir, .{});
                     defer installing_dir_opened.close();
-
-                    var archive_file = try std.fs.openFileAbsolute(archive_absolute, .{});
-                    defer archive_file.close();
-                    var archive = zarc.zip.Parser(std.fs.File.Reader).init(allocator, archive_file.reader());
-                    defer archive.deinit();
                     std.debug.print("extracting archive to \"{s}\"\n", .{installing_dir});
                     var timer = try std.time.Timer.start();
-                    try archive.load();
-                    _ = try archive.extract(installing_dir_opened, .{});
+                    var archive_file = try std.fs.openFileAbsolute(archive_absolute, .{});
+                    defer archive_file.close();
+                    const reader = archive_file.reader();
+                    var archive = try zarc.zip.load(allocator, reader);
+                    defer archive.deinit(allocator);
+                    _ = try archive.extract(reader, installing_dir_opened, .{});
                     const time = timer.read();
                     std.debug.print("extracted archive in {d:.2} s\n", .{@intToFloat(f32, time) / @intToFloat(f32, std.time.ns_per_s)});
                 }