diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2020-12-09 21:20:13 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2020-12-09 21:20:13 -0700 |
| commit | cb896a657358d5add8970826277f66a20fecc2df (patch) | |
| tree | f4c2bbd93ab6a41cca87b7afe79bff491ddbc15d | |
| parent | 4c51adeb0d1dac916dfc117244e14804d3adec8d (diff) | |
| download | zig-cb896a657358d5add8970826277f66a20fecc2df.tar.gz zig-cb896a657358d5add8970826277f66a20fecc2df.zip | |
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.
| -rw-r--r-- | src/main.zig | 4 |
1 files changed, 2 insertions, 2 deletions
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) { |
