authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-11-24 23:09:27-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-11-24 23:09:27-07:00
logc9352ef9d6d9f1bca94c25710e11de0ae171605f
treebbb5effcab22db06c7af803851e51b9f9248c1f7
parent078a7ff198c46aea98b8837ae9fab52626dd01a0

stage2: fix logic for default -femit-implib path

Previously when using `--enable-cache` and creating a Windows DLL, without overriding the `-femit-implib` option, Zig would incorrectly dump the .lib file to the current working directory, rather than outputting it into the artifact directory, next to the .dll file. Fixed.

1 files changed, 13 insertions(+), 11 deletions(-)

src/main.zig+13-11
......@@ -2130,18 +2130,20 @@ fn buildOutputType(
21302130 }
21312131 }
21322132 const default_implib_basename = try std.fmt.allocPrint(arena, "{s}.lib", .{root_name});
2133 var emit_implib_resolved = emit_implib.resolve(default_implib_basename) catch |err| {
2134 switch (emit_implib) {
2135 .yes => |p| {
2136 fatal("unable to open directory from argument '-femit-implib', '{s}': {s}", .{
2137 p, @errorName(err),
2138 });
2139 },
2140 .yes_default_path => {
2141 fatal("unable to open directory 'docs': {s}", .{@errorName(err)});
2133 var emit_implib_resolved = switch (emit_implib) {
2134 .no => Emit.Resolved{ .data = null, .dir = null },
2135 .yes => |p| emit_implib.resolve(default_implib_basename) catch |err| {
2136 fatal("unable to open directory from argument '-femit-implib', '{s}': {s}", .{
2137 p, @errorName(err),
2138 });
2139 },
2140 .yes_default_path => Emit.Resolved{
2141 .data = Compilation.EmitLoc{
2142 .directory = emit_bin_loc.?.directory,
2143 .basename = default_implib_basename,
21422144 },
2143 .no => unreachable,
2144 }
2145 .dir = null,
2146 },
21452147 };
21462148 defer emit_implib_resolved.deinit();
21472149