authorgravatar for igor.anic@gmail.comIgor Anić <igor.anic@gmail.com> 2024-04-04 19:12:57+02:00
committergravatar for igor.anic@gmail.comIgor Anić <igor.anic@gmail.com> 2024-04-09 15:00:22+02:00
log5f0b434f9031179609c97676bb43425f8710ac95
tree8b47befd714c8c9b81101dbcd0ff59a473d0782b
parent22e9c50376b8d7f2c67e3727bc40c697942576c8

fetch: remove root_dir from error messages

To be consistent with paths in manifest.

1 files changed, 7 insertions(+), 5 deletions(-)

src/Package/Fetch.zig+7-5
......@@ -1861,6 +1861,8 @@ const UnpackResult = struct {
18611861 if (self.errors.items.len == 0 and self.root_error_message.len == 0)
18621862 return;
18631863
1864 const root_dir = if (self.root_dir) |root_dir| root_dir else "";
1865
18641866 const notes_len: u32 = @intCast(self.errors.items.len);
18651867 try eb.addRootErrorMessage(.{
18661868 .msg = try eb.addString(self.root_error_message),
......@@ -1873,21 +1875,21 @@ const UnpackResult = struct {
18731875 .unable_to_create_sym_link => |info| {
18741876 eb.extra.items[note_i] = @intFromEnum(try eb.addErrorMessage(.{
18751877 .msg = try eb.printString("unable to create symlink from '{s}' to '{s}': {s}", .{
1876 info.file_name, info.link_name, @errorName(info.code),
1878 stripRoot(info.file_name, root_dir), info.link_name, @errorName(info.code),
18771879 }),
18781880 }));
18791881 },
18801882 .unable_to_create_file => |info| {
18811883 eb.extra.items[note_i] = @intFromEnum(try eb.addErrorMessage(.{
18821884 .msg = try eb.printString("unable to create file '{s}': {s}", .{
1883 info.file_name, @errorName(info.code),
1885 stripRoot(info.file_name, root_dir), @errorName(info.code),
18841886 }),
18851887 }));
18861888 },
18871889 .unsupported_file_type => |info| {
18881890 eb.extra.items[note_i] = @intFromEnum(try eb.addErrorMessage(.{
18891891 .msg = try eb.printString("file '{s}' has unsupported type '{c}'", .{
1890 info.file_name, info.file_type,
1892 stripRoot(info.file_name, root_dir), info.file_type,
18911893 }),
18921894 }));
18931895 },
......@@ -1914,8 +1916,8 @@ test "tarball with duplicate file names" {
19141916
19151917 try fb.expectFetchErrors(2,
19161918 \\error: unable to unpack tarball
1917 \\ note: unable to create file 'package.tar/dir/file': PathAlreadyExists
1918 \\ note: unable to create file 'package.tar/dir1/file1': PathAlreadyExists
1919 \\ note: unable to create file 'dir/file': PathAlreadyExists
1920 \\ note: unable to create file 'dir1/file1': PathAlreadyExists
19191921 \\
19201922 );
19211923}