Mod change from iterator to walker to allow trees#3266
Conversation
IntegratedQuantum
left a comment
There was a problem hiding this comment.
Do you think you could also sort these alphabetically? The file system order is usually not sorted.
Added. |
|
I didn't like how different "mods" were cramped together so I did this: // MARK: anti-cubyz
pub const @"anti-cubyz:branch" = @import("anti-cubyz/rotations/branch.zig");
pub const @"anti-cubyz:carpet" = @import("anti-cubyz/rotations/carpet.zig");
pub const @"anti-cubyz:decayable" = @import("anti-cubyz/rotations/decayable.zig");
...
// MARK: cubyz
pub const @"cubyz:branch" = @import("cubyz/rotations/branch.zig");
pub const @"cubyz:carpet" = @import("cubyz/rotations/carpet.zig");
pub const @"cubyz:decayable" = @import("cubyz/rotations/decayable.zig");
... |
| }.lessThanFn); | ||
|
|
||
| try featureList.appendSlice(step.owner.allocator, step.owner.fmt( | ||
| \\ |
There was a problem hiding this comment.
Could you also remove the empty line at the start of the file?
There was a problem hiding this comment.
Instead of blindly discarding the first character at the end, I'd prefer a conditional here:
if (featureList.items.len != 0) featureList.append('\n');
| \\// MARK: {s} | ||
| \\ | ||
| , .{modEntry.name})); | ||
| try featureList.appendSlice(step.owner.allocator, try std.mem.join(step.owner.allocator, "\n", modFeatureList.items)); |
There was a problem hiding this comment.
Please just use a for loops instead of making a needless intermediate allocation.
There was a problem hiding this comment.
I don't quite get what you exactly mean? Do you want me to use a [][]const u8 completly and only join at the end or what? I cannot operate directly on the slice going to the file as I am sorting on the [][]const u8 and not []const u8
There was a problem hiding this comment.
I mean to call appendSlice in a for loop instead of using join to prevent the needless intermediate allocation
There was a problem hiding this comment.
ohhh. I see now. Yeah it does a needless intermediate allocation. I made it now into a for loop
In preparation for moving other
_list.zigthis implements my understanding of #1630 (comment) for the rotations.(It doesn't anymore, as we saw a problem with it)