| ... | ... | @@ -1702,8 +1702,7 @@ pub fn resolveLazyPath( |
| 1702 | 1702 | arena: Allocator, |
| 1703 | 1703 | lazy_path: Configuration.LazyPath, |
| 1704 | 1704 | asking_step_index: Configuration.Step.Index, |
| 1705 | | ) Allocator.Error!Path { |
| 1706 | | _ = asking_step_index; // TODO use this to enhance debugability when this function fails |
| 1705 | ) error{ OutOfMemory, MakeFailed }!Path { |
| 1707 | 1706 | const c = &maker.scanned_config.configuration; |
| 1708 | 1707 | return switch (lazy_path) { |
| 1709 | 1708 | .source_path => |sp| try packagePath(maker, arena, sp.owner, sp.sub_path.slice(c)), |
| ... | ... | @@ -1712,8 +1711,10 @@ pub fn resolveLazyPath( |
| 1712 | 1711 | const base = generatedPath(maker, gen.index); |
| 1713 | 1712 | var file_path = base; |
| 1714 | 1713 | for (0..gen.flags.up) |_| { |
| 1715 | | file_path.sub_path = Dir.path.dirname(file_path.sub_path) orelse |
| 1716 | | fatal("invalid LazyPath traversal: up {d} times from {f}", .{ gen.flags.up, base }); |
| 1714 | file_path.sub_path = Dir.path.dirname(file_path.sub_path) orelse { |
| 1715 | const s = stepByIndex(maker, asking_step_index); |
| 1716 | return s.fail(maker, "invalid LazyPath traversal: up {d} times from {f}", .{ gen.flags.up, base }); |
| 1717 | }; |
| 1717 | 1718 | } |
| 1718 | 1719 | return file_path.join(arena, gen.sub_path.slice(c)); |
| 1719 | 1720 | }, |
| ... | ... | @@ -1725,7 +1726,7 @@ pub fn resolveLazyPathIndex( |
| 1725 | 1726 | arena: Allocator, |
| 1726 | 1727 | lazy_path_index: Configuration.LazyPath.Index, |
| 1727 | 1728 | asking_step_index: Configuration.Step.Index, |
| 1728 | | ) Allocator.Error!Path { |
| 1729 | ) error{ OutOfMemory, MakeFailed }!Path { |
| 1729 | 1730 | const c = &maker.scanned_config.configuration; |
| 1730 | 1731 | return resolveLazyPath(maker, arena, lazy_path_index.get(c), asking_step_index); |
| 1731 | 1732 | } |
| ... | ... | @@ -1737,7 +1738,7 @@ pub fn resolveLazyPathAbs( |
| 1737 | 1738 | arena: Allocator, |
| 1738 | 1739 | lazy_path: Configuration.LazyPath, |
| 1739 | 1740 | asking_step_index: Configuration.Step.Index, |
| 1740 | | ) Allocator.Error![]const u8 { |
| 1741 | ) error{ OutOfMemory, MakeFailed }![]const u8 { |
| 1741 | 1742 | const p = try resolveLazyPath(maker, arena, lazy_path, asking_step_index); |
| 1742 | 1743 | const root_dir_path = p.root_dir.path orelse return p.subPathOrDot(); |
| 1743 | 1744 | if (p.sub_path.len == 0) return root_dir_path; |
| ... | ... | @@ -1751,7 +1752,7 @@ pub fn resolveLazyPathIndexAbs( |
| 1751 | 1752 | arena: Allocator, |
| 1752 | 1753 | lazy_path_index: Configuration.LazyPath.Index, |
| 1753 | 1754 | asking_step_index: Configuration.Step.Index, |
| 1754 | | ) Allocator.Error![]const u8 { |
| 1755 | ) error{ OutOfMemory, MakeFailed }![]const u8 { |
| 1755 | 1756 | const c = &maker.scanned_config.configuration; |
| 1756 | 1757 | return resolveLazyPathAbs(maker, arena, lazy_path_index.get(c), asking_step_index); |
| 1757 | 1758 | } |