authorgravatar for frmdstryr@protonmail.comfrmdstryr <frmdstryr@protonmail.com> 2021-06-07 13:10:15 -04:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2021-06-07 13:10:15 -04:00
log93950d9a7c4cd155849eb441e641681e8fafd52c
tree4c09511c56b43f77a70a174dff34516dcec1dcfb
parentfcd70831ae5913e52ccc87149bcc99859eb0e81d
signaturebadge-question-mark Signed by PGP key 4AEE18F83AFDEB23

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

1 files changed, 1 insertions(+), 0 deletions(-)

src/cmd/init.zig+1
...@@ -26,6 +26,7 @@ fn detect_pkgname(def: []const u8) ![]const u8 {...@@ -26,6 +26,7 @@ fn detect_pkgname(def: []const u8) ![]const u8 {
26 if (def.len > 0) {26 if (def.len > 0) {
27 return def;27 return def;
28 }28 }
29 u.assert(try u.does_file_exist("build.zig"), "init requires a build.zig file", .{});
29 const dpath = try std.fs.cwd().realpathAlloc(gpa, "build.zig");30 const dpath = try std.fs.cwd().realpathAlloc(gpa, "build.zig");
30 const split = try u.split(dpath, std.fs.path.sep_str);31 const split = try u.split(dpath, std.fs.path.sep_str);
31 var name = split[split.len - 2];32 var name = split[split.len - 2];