diff options
| author | 2023-04-02 21:47:15 +0300 | |
|---|---|---|
| committer | 2023-04-02 21:50:01 +0300 | |
| commit | a6dbcffe2ce03f9571da693852181a785942ec4b (patch) | |
| tree | ab5eb4b7591c104fd04758c32039dda03b67f3ea /src/Installation.zig | |
| parent | Release 0.2.1 (diff) | |
| download | zup-a6dbcffe2ce03f9571da693852181a785942ec4b.tar.gz zup-a6dbcffe2ce03f9571da693852181a785942ec4b.tar.xz zup-a6dbcffe2ce03f9571da693852181a785942ec4b.zip | |
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.
Diffstat (limited to 'src/Installation.zig')
| -rw-r--r-- | src/Installation.zig | 18 |
1 files changed, 4 insertions, 14 deletions
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 @@ | |||
| 1 | const curl = @import("curl"); | ||
| 1 | const std = @import("std"); | 2 | const std = @import("std"); |
| 2 | const xdg = @import("xdg"); | 3 | const xdg = @import("xdg"); |
| 3 | const zelda = @import("zelda"); | ||
| 4 | const zup = @import("zup"); | 4 | const zup = @import("zup"); |
| 5 | 5 | ||
| 6 | const Allocator = std.mem.Allocator; | 6 | const Allocator = std.mem.Allocator; |
| @@ -135,23 +135,13 @@ pub fn isInstalled(allocator: Allocator, name: []const u8) !bool { | |||
| 135 | pub fn getAvailableList(config: Config) !Installations { | 135 | pub fn getAvailableList(config: Config) !Installations { |
| 136 | const allocator = config.allocator; | 136 | const allocator = config.allocator; |
| 137 | 137 | ||
| 138 | var response = try zelda.get(allocator, "https://ziglang.org/download/index.json"); | 138 | var json_str = try curl.easyDownload(allocator, "https://ziglang.org/download/index.json"); |
| 139 | defer response.deinit(); | 139 | defer allocator.free(json_str); |
| 140 | |||
| 141 | if (response.status_code.group() != .success) { | ||
| 142 | std.log.err("HTTP Error while getting Zig download index.json: {}", .{response.status_code}); | ||
| 143 | return error.HttpError; | ||
| 144 | } | ||
| 145 | |||
| 146 | if (response.body == null) { | ||
| 147 | std.log.err("No body response while getting Zig download index.json", .{}); | ||
| 148 | return error.HttpError; | ||
| 149 | } | ||
| 150 | 140 | ||
| 151 | var parser = std.json.Parser.init(allocator, false); | 141 | var parser = std.json.Parser.init(allocator, false); |
| 152 | defer parser.deinit(); | 142 | defer parser.deinit(); |
| 153 | 143 | ||
| 154 | var vt = try parser.parse(response.body.?); | 144 | var vt = try parser.parse(json_str); |
| 155 | defer vt.deinit(); | 145 | defer vt.deinit(); |
| 156 | 146 | ||
| 157 | if (vt.root != .Object) { | 147 | if (vt.root != .Object) { |