mirror of
https://github.com/ziglang/zig.git
synced 2026-02-20 16:24:51 +00:00
autodoc: don't hardcode file name
This commit is contained in:
parent
652e13e7c0
commit
025337a78d
@ -26,9 +26,16 @@ pub fn generateZirData(self: Autodoc) !void {
|
||||
std.debug.print("basename: {s}\n", .{loc.basename});
|
||||
}
|
||||
|
||||
// const root_file_path = self.module.main_pkg.root_src_path;
|
||||
const root_file_path = "/home/kristoff/test/test.zig";
|
||||
const zir = self.module.import_table.get(root_file_path).?.zir;
|
||||
var buf: [std.fs.MAX_PATH_BYTES]u8 = undefined;
|
||||
const dir =
|
||||
if (self.module.main_pkg.root_src_directory.path) |rp|
|
||||
std.os.realpath(rp, &buf) catch unreachable
|
||||
else
|
||||
std.os.getcwd(&buf) catch unreachable;
|
||||
const root_file_path = self.module.main_pkg.root_src_path;
|
||||
const abs_root_path = try std.fs.path.join(gpa, &.{ dir, root_file_path });
|
||||
defer gpa.free(abs_root_path);
|
||||
const zir = self.module.import_table.get(abs_root_path).?.zir;
|
||||
|
||||
var types = std.ArrayList(DocData.Type).init(gpa);
|
||||
var decls = std.ArrayList(DocData.Decl).init(gpa);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user