From a6dbcffe2ce03f9571da693852181a785942ec4b Mon Sep 17 00:00:00 2001 From: Uko Kokņevičs Date: Sun, 2 Apr 2023 21:47:15 +0300 Subject: Actually use my zig-curl instead of zelda. I'll wait until zelda & zig get more stable and get more contributors. Also, zelda has been archived on April 1st, perhaps a joke, perhaps not. This reverts commit 081e79c3fa385c662a5a6b7faf717ec370b398c8. This reverts commit 33226c20c41e3fe2de3330b6692c90bc4818b119. This reverts commit 3b3baf375be63acfd293b1b47a5f49aab4b06a70. --- src/Installation.zig | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) (limited to 'src/Installation.zig') diff --git a/src/Installation.zig b/src/Installation.zig index 3c056b9..4f7a48d 100644 --- a/src/Installation.zig +++ b/src/Installation.zig @@ -1,6 +1,6 @@ +const curl = @import("curl"); const std = @import("std"); const xdg = @import("xdg"); -const zelda = @import("zelda"); const zup = @import("zup"); const Allocator = std.mem.Allocator; @@ -135,23 +135,13 @@ pub fn isInstalled(allocator: Allocator, name: []const u8) !bool { pub fn getAvailableList(config: Config) !Installations { const allocator = config.allocator; - var response = try zelda.get(allocator, "https://ziglang.org/download/index.json"); - defer response.deinit(); - - if (response.status_code.group() != .success) { - std.log.err("HTTP Error while getting Zig download index.json: {}", .{response.status_code}); - return error.HttpError; - } - - if (response.body == null) { - std.log.err("No body response while getting Zig download index.json", .{}); - return error.HttpError; - } + var json_str = try curl.easyDownload(allocator, "https://ziglang.org/download/index.json"); + defer allocator.free(json_str); var parser = std.json.Parser.init(allocator, false); defer parser.deinit(); - var vt = try parser.parse(response.body.?); + var vt = try parser.parse(json_str); defer vt.deinit(); if (vt.root != .Object) { -- cgit v1.2.3