Best way to get the module path

Using @src().file I can get the path of the source file relative to its module. But I still need the location of the module to get to the file.

I can use Module.addOptions() to pass this info from build.zig. But is there any standard/builtin way that I’ve missed?

1 Like

no other way to do it. Why do you need that precise of a location?

In TigerBeetle snaptest can update snapshots in source code. And currently the module path is hardcoded: tigerbeetle/src/testing/snaptest.zig at 11934198f2a208469882f130291e8c73a404922a · tigerbeetle/tigerbeetle · GitHub

1 Like

that is a pretty good reason, unfortunately the best solution seems to be using the build system options to pass that to the module.

this reminded me about an idea i had Exporting data to the build system