zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 5395c2786a2ea9fd70e8c91aab099976216089aa (tree)
parent 000aa30086eb4b470d2b567ce377f0e4a9d9a516
Author: Ian Johnson <ian@ianjohnson.dev>
Date:   Thu, 10 Aug 2023 21:36:21 -0400

Autodoc: fix guide path resolution

The previous logic was using `root_src_directory` both in constructing
the resolved path and as the root when opening the resolved path, which
effectively duplicates those path components in the final path.

Diffstat:
Msrc/Autodoc.zig | 3+--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/Autodoc.zig b/src/Autodoc.zig @@ -5537,9 +5537,8 @@ fn findGuidePaths(self: *Autodoc, file: *File, str: []const u8) ![]const u8 { fn addGuide(self: *Autodoc, file: *File, guide_path: []const u8, section: *Section) !void { if (guide_path.len == 0) return error.MissingAutodocGuideName; - const cur_mod_dir_path = file.pkg.root_src_directory.path orelse "."; const resolved_path = try std.fs.path.resolve(self.arena, &[_][]const u8{ - cur_mod_dir_path, file.sub_file_path, "..", guide_path, + file.sub_file_path, "..", guide_path, }); var guide_file = try file.pkg.root_src_directory.handle.openFile(resolved_path, .{});