| ... | @@ -26,9 +26,16 @@ pub fn generateZirData(self: Autodoc) !void { | ... | @@ -26,9 +26,16 @@ pub fn generateZirData(self: Autodoc) !void { |
| 26 | std.debug.print("basename: {s}\n", .{loc.basename}); | 26 | std.debug.print("basename: {s}\n", .{loc.basename}); |
| 27 | } | 27 | } |
| 28 | | 28 | |
| 29 | // const root_file_path = self.module.main_pkg.root_src_path; | 29 | var buf: [std.fs.MAX_PATH_BYTES]u8 = undefined; |
| 30 | const root_file_path = "/home/kristoff/test/test.zig"; | 30 | const dir = |
| 31 | const zir = self.module.import_table.get(root_file_path).?.zir; | 31 | if (self.module.main_pkg.root_src_directory.path) |rp| |
| | 32 | std.os.realpath(rp, &buf) catch unreachable |
| | 33 | else |
| | 34 | std.os.getcwd(&buf) catch unreachable; |
| | 35 | const root_file_path = self.module.main_pkg.root_src_path; |
| | 36 | const abs_root_path = try std.fs.path.join(gpa, &.{ dir, root_file_path }); |
| | 37 | defer gpa.free(abs_root_path); |
| | 38 | const zir = self.module.import_table.get(abs_root_path).?.zir; |
| 32 | | 39 | |
| 33 | var types = std.ArrayList(DocData.Type).init(gpa); | 40 | var types = std.ArrayList(DocData.Type).init(gpa); |
| 34 | var decls = std.ArrayList(DocData.Decl).init(gpa); | 41 | var decls = std.ArrayList(DocData.Decl).init(gpa); |