Skip to content

Commit

Permalink
rename tools.get_version to tools.get_current_version
Browse files Browse the repository at this point in the history
  • Loading branch information
jinzhongjia committed Aug 7, 2024
1 parent ffc245d commit cba75d5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/alias.zig
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ fn update_current(zig_path: []const u8, symlink_path: []const u8) !void {
fn verify_zig_version(expected_version: []const u8) !void {
const allocator = tools.get_allocator();

const actual_version = try tools.get_version(allocator, false);
const actual_version = try tools.get_current_version(allocator, false);
defer allocator.free(actual_version);

if (!std.mem.eql(u8, expected_version, actual_version)) {
Expand All @@ -83,7 +83,7 @@ fn verify_zig_version(expected_version: []const u8) !void {
fn verify_zls_version(expected_version: []const u8) !void {
const allocator = tools.get_allocator();

const actual_version = try tools.get_version(allocator, true);
const actual_version = try tools.get_current_version(allocator, true);
defer allocator.free(actual_version);

if (!std.mem.eql(u8, expected_version, actual_version)) {
Expand Down
2 changes: 1 addition & 1 deletion src/remove.zig
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pub fn remove(version: []const u8, is_zls: bool) !void {

// try remove current path
if (tools.does_path_exist(current_path)) {
const current_version = try tools.get_version(allocator, is_zls);
const current_version = try tools.get_current_version(allocator, is_zls);
if (tools.eql_str(current_version, true_version)) {
if (builtin.os.tag == .windows) {
try std.fs.deleteTreeAbsolute(current_path);
Expand Down
4 changes: 2 additions & 2 deletions src/tools.zig
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,8 @@ pub fn try_create_path(path: []const u8) !void {
if (err != error.PathAlreadyExists) return err;
}

/// try to get zig version
pub fn get_version(allocator: std.mem.Allocator, is_zls: bool) ![]u8 {
/// try to get zig/zls version
pub fn get_current_version(allocator: std.mem.Allocator, is_zls: bool) ![]u8 {
var arena = std.heap.ArenaAllocator.init(allocator);
defer arena.deinit();
const arena_allocator = arena.allocator();
Expand Down

0 comments on commit cba75d5

Please sign in to comment.