One Zig folder to store them all?

My 2 ct: IMHO it’s really just the output directories which I don’t particularly like (zig-out and .zig-cache), IMHO those should both go into a .zig directory (e.g. .zig/bin,.zig/lib … and also .zig/cache), and that .zig directory should be safe to delete at any time (e.g. no version-controlled files in there).

That way a Zig project only needs one entry in .gitignore

build.zig and build.zig.zon should remain in the root IMHO.

Not sure if this is a good idea but I throw it in here anyway: Maybe build.zig.zon should contain more (optional) metadata (like the location of the root build.zig file, and maybe also the output and cache location - maybe even custom settings for other tools like ZLS), so that build.zig.zon becomes the only file required in the root and all other locations are defined by this one root file. At that point build.zig.zon should probably be renamed to project.zon though (or package.zon but that would be a bit heretic lol)

18 Likes