From 93950d9a7c4cd155849eb441e641681e8fafd52c Mon Sep 17 00:00:00 2001 From: frmdstryr Date: Mon, 7 Jun 2021 13:10:15 -0400 Subject: [PATCH] Add a message if build.zig file is not present Not sure if this is the right place or correct message but I got an error trace doing zigmod init without a `build.zig` file --- src/cmd/init.zig | 1 + 1 file changed, 1 insertion(+) diff --git a/src/cmd/init.zig b/src/cmd/init.zig index 93e2af7033e8e2d20589b5f5c614fec18b758a3d..55469cb52640a3243c7c0f9acf4d4c877e038e6d 100644 --- a/src/cmd/init.zig +++ b/src/cmd/init.zig @@ -26,6 +26,7 @@ fn detect_pkgname(def: []const u8) ![]const u8 { if (def.len > 0) { return def; } + u.assert(try u.does_file_exist("build.zig"), "init requires a build.zig file", .{}); const dpath = try std.fs.cwd().realpathAlloc(gpa, "build.zig"); const split = try u.split(dpath, std.fs.path.sep_str); var name = split[split.len - 2]; -- 2.54.0