diff options
author | 2022-03-08 18:54:54 -0800 | |
---|---|---|
committer | 2022-03-08 18:54:54 -0800 | |
commit | 701d6ec45d7e339b352b37869bd2a7d4849b35fb (patch) | |
tree | a88a0b03a2e644d5e1bd51eb609526b75f78ef53 /src/which.zig | |
parent | 787769ac3912fce6d1ffdbd384f19b800e133362 (diff) | |
download | bun-701d6ec45d7e339b352b37869bd2a7d4849b35fb.tar.gz bun-701d6ec45d7e339b352b37869bd2a7d4849b35fb.tar.zst bun-701d6ec45d7e339b352b37869bd2a7d4849b35fb.zip |
rename _global -> bun
Diffstat (limited to 'src/which.zig')
-rw-r--r-- | src/which.zig | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/which.zig b/src/which.zig index a6009200c..9303d6503 100644 --- a/src/which.zig +++ b/src/which.zig @@ -1,6 +1,6 @@ const std = @import("std"); -const _global = @import("./global.zig"); -fn isValid(buf: *[_global.MAX_PATH_BYTES]u8, segment: []const u8, bin: []const u8) ?u16 { +const bun = @import("./global.zig"); +fn isValid(buf: *[bun.MAX_PATH_BYTES]u8, segment: []const u8, bin: []const u8) ?u16 { std.mem.copy(u8, buf, segment); buf[segment.len] = std.fs.path.sep; std.mem.copy(u8, buf[segment.len + 1 ..], bin); @@ -14,7 +14,7 @@ fn isValid(buf: *[_global.MAX_PATH_BYTES]u8, segment: []const u8, bin: []const u // Like /usr/bin/which but without needing to exec a child process // Remember to resolve the symlink if necessary -pub fn which(buf: *[_global.MAX_PATH_BYTES]u8, path: []const u8, cwd: []const u8, bin: []const u8) ?[:0]const u8 { +pub fn which(buf: *[bun.MAX_PATH_BYTES]u8, path: []const u8, cwd: []const u8, bin: []const u8) ?[:0]const u8 { if (isValid(buf, std.mem.trimRight(u8, cwd, std.fs.path.sep_str), bin)) |len| { return buf[0..len :0]; } @@ -30,7 +30,7 @@ pub fn which(buf: *[_global.MAX_PATH_BYTES]u8, path: []const u8, cwd: []const u8 } test "which" { - var buf: [_global.MAX_PATH_BYTES]u8 = undefined; + var buf: [bun.MAX_PATH_BYTES]u8 = undefined; var realpath = std.os.getenv("PATH") orelse unreachable; var whichbin = which(&buf, realpath, try std.process.getCwdAlloc(std.heap.c_allocator), "which"); try std.testing.expectEqualStrings(whichbin orelse return std.debug.assert(false), "/usr/bin/which"); |