authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-12-09 21:20:13-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-12-09 21:20:13-07:00
logcb896a657358d5add8970826277f66a20fecc2df
treef4c2bbd93ab6a41cca87b7afe79bff491ddbc15d
parent4c51adeb0d1dac916dfc117244e14804d3adec8d

CLI: infer --name based on first C source file or object

Previously, --name would only be inferred if there was exactly 1 C source file or exactly 1 object. Now it will be inferred if there is at least one of either.

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

src/main.zig+2-2
...@@ -1340,10 +1340,10 @@ fn buildOutputType(...@@ -1340,10 +1340,10 @@ fn buildOutputType(
1340 } else if (root_src_file) |file| {1340 } else if (root_src_file) |file| {
1341 const basename = fs.path.basename(file);1341 const basename = fs.path.basename(file);
1342 break :blk mem.split(basename, ".").next().?;1342 break :blk mem.split(basename, ".").next().?;
1343 } else if (c_source_files.items.len == 1) {1343 } else if (c_source_files.items.len >= 1) {
1344 const basename = fs.path.basename(c_source_files.items[0].src_path);1344 const basename = fs.path.basename(c_source_files.items[0].src_path);
1345 break :blk mem.split(basename, ".").next().?;1345 break :blk mem.split(basename, ".").next().?;
1346 } else if (link_objects.items.len == 1) {1346 } else if (link_objects.items.len >= 1) {
1347 const basename = fs.path.basename(link_objects.items[0]);1347 const basename = fs.path.basename(link_objects.items[0]);
1348 break :blk mem.split(basename, ".").next().?;1348 break :blk mem.split(basename, ".").next().?;
1349 } else if (emit_bin == .yes) {1349 } else if (emit_bin == .yes) {