From cb896a657358d5add8970826277f66a20fecc2df Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Wed, 9 Dec 2020 21:20:13 -0700 Subject: 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. --- src/main.zig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/main.zig b/src/main.zig index abb1b61319..af342e523f 100644 --- a/src/main.zig +++ b/src/main.zig @@ -1340,10 +1340,10 @@ fn buildOutputType( } else if (root_src_file) |file| { const basename = fs.path.basename(file); break :blk mem.split(basename, ".").next().?; - } else if (c_source_files.items.len == 1) { + } else if (c_source_files.items.len >= 1) { const basename = fs.path.basename(c_source_files.items[0].src_path); break :blk mem.split(basename, ".").next().?; - } else if (link_objects.items.len == 1) { + } else if (link_objects.items.len >= 1) { const basename = fs.path.basename(link_objects.items[0]); break :blk mem.split(basename, ".").next().?; } else if (emit_bin == .yes) { -- cgit v1.2.3