Skip to content

Commit

Permalink
Simplify API
Browse files Browse the repository at this point in the history
  • Loading branch information
jinzhongjia committed Jul 26, 2024
1 parent 6846010 commit d3be2a2
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/alias.zig
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pub fn set_zig_version(version: []const u8) !void {

const user_home = tools.get_home();
const zig_path = try std.fs.path.join(arena_allocator, &[_][]const u8{ user_home, ".zm", "versions", version });
const symlink_path = try std.fs.path.join(arena_allocator, &[_][]const u8{ user_home, ".zm", "current" });
const symlink_path = try tools.get_zvm_path_segment(arena_allocator, "current");

try update_symlink(zig_path, symlink_path);
try verify_zig_version(allocator, version);
Expand Down Expand Up @@ -121,8 +121,7 @@ fn verify_zig_version(allocator: std.mem.Allocator, expected_version: []const u8
}

fn retrieve_zig_version(allocator: std.mem.Allocator) ![]u8 {
const user_home = tools.get_home();
const symlink_path = try std.fs.path.join(allocator, &[_][]const u8{ user_home, ".zm", "current" });
const symlink_path = try tools.get_zvm_path_segment(allocator, "current");
defer allocator.free(symlink_path);

var child_process = std.process.Child.init(&[_][]const u8{ "zig", "version" }, allocator);
Expand Down

0 comments on commit d3be2a2

Please sign in to comment.