summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build.zig14
-rw-r--r--build.zig.zon10
-rw-r--r--src/Installation.zig2
3 files changed, 11 insertions, 15 deletions
diff --git a/build.zig b/build.zig
index f1159b0..20ac769 100644
--- a/build.zig
+++ b/build.zig
@@ -20,10 +20,7 @@ pub fn build(b: *Build) void {
20 const exe = b.addExecutable(.{ 20 const exe = b.addExecutable(.{
21 .name = "zup", 21 .name = "zup",
22 .version = version, 22 .version = version,
23 .root_source_file = .{ .src_path = .{ 23 .root_source_file = b.path("src/main.zig"),
24 .owner = b,
25 .sub_path = "src/main.zig",
26 } },
27 .target = target, 24 .target = target,
28 .optimize = optimize, 25 .optimize = optimize,
29 }); 26 });
@@ -43,10 +40,7 @@ pub fn build(b: *Build) void {
43 run_step.dependOn(&run_cmd.step); 40 run_step.dependOn(&run_cmd.step);
44 41
45 const exe_tests = b.addTest(.{ 42 const exe_tests = b.addTest(.{
46 .root_source_file = .{ .src_path = .{ 43 .root_source_file = b.path("src/main.zig"),
47 .owner = b,
48 .sub_path = "src/main.zig",
49 } },
50 .target = target, 44 .target = target,
51 .optimize = optimize, 45 .optimize = optimize,
52 }); 46 });
@@ -55,7 +49,7 @@ pub fn build(b: *Build) void {
55 test_step.dependOn(&exe_tests.step); 49 test_step.dependOn(&exe_tests.step);
56} 50}
57 51
58const default_version = SemanticVersion.parse("0.2.1") catch unreachable; 52const default_version = SemanticVersion.parse("0.5.0") catch unreachable;
59 53
60fn getVersion(b: *Build) SemanticVersion { 54fn getVersion(b: *Build) SemanticVersion {
61 var out_code: u8 = undefined; 55 var out_code: u8 = undefined;
@@ -70,7 +64,7 @@ fn getVersion(b: *Build) SemanticVersion {
70 const ver_str = switch (std.mem.count(u8, git_desc, "-")) { 64 const ver_str = switch (std.mem.count(u8, git_desc, "-")) {
71 0 => git_desc, 65 0 => git_desc,
72 2 => blk: { 66 2 => blk: {
73 var it = std.mem.split(u8, git_desc, "-"); 67 var it = std.mem.splitScalar(u8, git_desc, '-');
74 const tag = it.next() orelse unreachable; 68 const tag = it.next() orelse unreachable;
75 const height = it.next() orelse unreachable; 69 const height = it.next() orelse unreachable;
76 const hash = it.next() orelse unreachable; 70 const hash = it.next() orelse unreachable;
diff --git a/build.zig.zon b/build.zig.zon
index 2d7a69c..30c1f64 100644
--- a/build.zig.zon
+++ b/build.zig.zon
@@ -9,12 +9,14 @@
9 .hash = "122062d301a203d003547b414237229b09a7980095061697349f8bef41be9c30266b", 9 .hash = "122062d301a203d003547b414237229b09a7980095061697349f8bef41be9c30266b",
10 }, 10 },
11 .libarchive = .{ 11 .libarchive = .{
12 .url = "https://git.enes.lv/zig-libarchive/snapshot/zig-libarchive-0.4.0.tar.xz", 12 // .path = "../zig-libarchive",
13 .hash = "1220b21cc99fca50b7fa495191a17abe440dc8229aa3bc5a638c4a0f2ffdceccbdda", 13 .url = "https://git.enes.lv/zig-libarchive/snapshot/zig-libarchive-3d457c968af4ddcb3bc89965272b46fc2aa91452.tar.xz",
14 .hash = "1220c60a6aa308f9541fa460cb42a43c5e011ce141b52bd1e01fd8fac7e347edee60",
14 }, 15 },
15 .xdg = .{ 16 .xdg = .{
16 .url = "https://git.enes.lv/zig-xdg/snapshot/zig-xdg-0.4.0.tar.xz", 17 // .path = "../zig-xdg",
17 .hash = "12206c1b6e163e79b83eb1e6cb1d575b256e603a0bbf9c2726e6f3235028eabbff41", 18 .url = "https://git.enes.lv/zig-xdg/snapshot/zig-xdg-7a1fe22046e374461c37fb232dca0a1a1733a532.tar.xz",
19 .hash = "12200288bfff905e157599e189cd44f14d34cbb544e2c126696dbbc71c5ddaf9058e",
18 }, 20 },
19 }, 21 },
20} 22}
diff --git a/src/Installation.zig b/src/Installation.zig
index 6e2e120..6c44089 100644
--- a/src/Installation.zig
+++ b/src/Installation.zig
@@ -45,7 +45,7 @@ pub fn getActiveName(allocator: Allocator) !?[]u8 {
45 var bin_home = try xdg.openBinHome(allocator); 45 var bin_home = try xdg.openBinHome(allocator);
46 defer bin_home.close(); 46 defer bin_home.close();
47 47
48 var buf: [std.fs.MAX_PATH_BYTES]u8 = undefined; 48 var buf: [std.fs.max_path_bytes]u8 = undefined;
49 const linkname = bin_home.readLink("zig", &buf) catch |err| { 49 const linkname = bin_home.readLink("zig", &buf) catch |err| {
50 if (err == error.NotLink or err == error.FileNotFound) { 50 if (err == error.NotLink or err == error.FileNotFound) {
51 return null; 51 return null;