| ... | @@ -1885,7 +1885,7 @@ pub fn update(self: *Compilation) !void { | ... | @@ -1885,7 +1885,7 @@ pub fn update(self: *Compilation) !void { |
| 1885 | | 1885 | |
| 1886 | // Flush takes care of -femit-bin, but we still have -femit-llvm-ir, -femit-llvm-bc, and | 1886 | // Flush takes care of -femit-bin, but we still have -femit-llvm-ir, -femit-llvm-bc, and |
| 1887 | // -femit-asm to handle, in the case of C objects. | 1887 | // -femit-asm to handle, in the case of C objects. |
| 1888 | try self.emitOthers(); | 1888 | self.emitOthers(); |
| 1889 | | 1889 | |
| 1890 | // If there are any errors, we anticipate the source files being loaded | 1890 | // If there are any errors, we anticipate the source files being loaded |
| 1891 | // to report error messages. Otherwise we unload all source files to save memory. | 1891 | // to report error messages. Otherwise we unload all source files to save memory. |
| ... | @@ -1902,7 +1902,7 @@ pub fn update(self: *Compilation) !void { | ... | @@ -1902,7 +1902,7 @@ pub fn update(self: *Compilation) !void { |
| 1902 | } | 1902 | } |
| 1903 | } | 1903 | } |
| 1904 | | 1904 | |
| 1905 | fn emitOthers(comp: *Compilation) !void { | 1905 | fn emitOthers(comp: *Compilation) void { |
| 1906 | if (comp.bin_file.options.output_mode != .Obj or comp.bin_file.options.module != null or | 1906 | if (comp.bin_file.options.output_mode != .Obj or comp.bin_file.options.module != null or |
| 1907 | comp.c_object_table.count() == 0) | 1907 | comp.c_object_table.count() == 0) |
| 1908 | { | 1908 | { |
| ... | @@ -1925,9 +1925,16 @@ fn emitOthers(comp: *Compilation) !void { | ... | @@ -1925,9 +1925,16 @@ fn emitOthers(comp: *Compilation) !void { |
| 1925 | for (outs) |out| { | 1925 | for (outs) |out| { |
| 1926 | if (out.emit) |loc| { | 1926 | if (out.emit) |loc| { |
| 1927 | if (loc.directory) |directory| { | 1927 | if (loc.directory) |directory| { |
| 1928 | const src_path = try std.fmt.allocPrint(comp.gpa, "{s}{s}", .{ basename, out.ext }); | 1928 | const src_path = std.fmt.allocPrint(comp.gpa, "{s}{s}", .{ |
| | 1929 | basename, out.ext, |
| | 1930 | }) catch |err| { |
| | 1931 | log.err("unable to copy {s}{s}: {s}", .{ basename, out.ext, @errorName(err) }); |
| | 1932 | continue; |
| | 1933 | }; |
| 1929 | defer comp.gpa.free(src_path); | 1934 | defer comp.gpa.free(src_path); |
| 1930 | try cwd.copyFile(src_path, directory.handle, loc.basename, .{}); | 1935 | cwd.copyFile(src_path, directory.handle, loc.basename, .{}) catch |err| { |
| | 1936 | log.err("unable to copy {s}: {s}", .{ src_path, @errorName(err) }); |
| | 1937 | }; |
| 1931 | } | 1938 | } |
| 1932 | } | 1939 | } |
| 1933 | } | 1940 | } |