aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/install/install.zig19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/install/install.zig b/src/install/install.zig
index e7cc1e332..6d9bd5409 100644
--- a/src/install/install.zig
+++ b/src/install/install.zig
@@ -5696,10 +5696,21 @@ pub const PackageManager = struct {
resolution: Resolution,
) void {
const buf = this.lockfile.buffers.string_bytes.items;
- const alias = if (this.lockfile.alias_map.get(package_id)) |str| str.slice(buf) else name;
- std.mem.copy(u8, &this.destination_dir_subpath_buf, alias);
- this.destination_dir_subpath_buf[alias.len] = 0;
- var destination_dir_subpath: [:0]u8 = this.destination_dir_subpath_buf[0..alias.len :0];
+
+ const destination_dir_subpath: [:0]u8 = brk: {
+ var alias = name;
+ if (this.lockfile.alias_map.get(package_id)) |str| {
+ alias = str.slice(buf);
+ std.mem.copy(u8, &this.destination_dir_subpath_buf, alias);
+ this.destination_dir_subpath_buf[alias.len] = 0;
+ break :brk this.destination_dir_subpath_buf[0..alias.len :0];
+ }
+
+ std.mem.copy(u8, &this.destination_dir_subpath_buf, alias);
+ this.destination_dir_subpath_buf[alias.len] = 0;
+ break :brk this.destination_dir_subpath_buf[0..alias.len :0];
+ };
+
var resolution_buf: [512]u8 = undefined;
const extern_string_buf = this.lockfile.buffers.extern_strings.items;
var resolution_label = std.fmt.bufPrint(&resolution_buf, "{}", .{resolution.fmt(buf)}) catch unreachable;