Zig 0.15: build snap

pull/9004/head
Mitchell Hashimoto 2025-10-02 15:53:38 -07:00
parent 2af424268a
commit e1b5464bab
No known key found for this signature in database
GPG Key ID: 523D5DC389D273BC
1 changed files with 8 additions and 10 deletions

View File

@ -1375,11 +1375,11 @@ pub const Surface = extern struct {
defer arena.deinit();
const alloc = arena.allocator();
var env_to_remove = std.ArrayList([]const u8).init(alloc);
var env_to_update = std.ArrayList(struct {
var env_to_remove: std.ArrayList([]const u8) = .empty;
var env_to_update: std.ArrayList(struct {
key: []const u8,
value: []const u8,
}).init(alloc);
}) = .empty;
var it = env_map.iterator();
while (it.next()) |entry| {
@ -1392,13 +1392,11 @@ pub const Surface = extern struct {
// Any env var starting with SNAP must be removed
if (std.mem.startsWith(u8, key, "SNAP_")) {
try env_to_remove.append(key);
try env_to_remove.append(alloc, key);
continue;
}
var filtered_paths = std.ArrayList([]const u8).init(alloc);
defer filtered_paths.deinit();
var filtered_paths: std.ArrayList([]const u8) = .empty;
var modified = false;
var paths = std.mem.splitAny(u8, value, ":");
while (paths.next()) |path| {
@ -1411,15 +1409,15 @@ pub const Surface = extern struct {
break;
}
};
if (include) try filtered_paths.append(path);
if (include) try filtered_paths.append(alloc, path);
}
if (modified) {
if (filtered_paths.items.len > 0) {
const new_value = try std.mem.join(alloc, ":", filtered_paths.items);
try env_to_update.append(.{ .key = key, .value = new_value });
try env_to_update.append(alloc, .{ .key = key, .value = new_value });
} else {
try env_to_remove.append(key);
try env_to_remove.append(alloc, key);
}
}
}