#What happened to `exe.setMainPkgPath`?

1 messages · Page 1 of 1 (latest)

fathom light
#

I would like to use this function mentioned here: https://github.com/ziglang/zig/issues/14637#issuecomment-1428944244
The function no longer seems to exists in zig 14, and I can not find an alternative, has it been renamed?

Context:
I want to use embedFile on a file as the same level as the src dir, not inside the src dir.

GitHub

Zig Version 0.11.0-dev.1606+3c2a43fdc Steps to Reproduce and Observed Behavior While my exact setup is different, a way to reproduce the issue is already documented on #14088 However, this issue is...

mint quest
#

there is no replacement for it, the pattern was not good to use.
now you should be using something like

exe.root_module.addAnonymousImport("foo", .{.root_source_path = b.path("foo.txt")};
...
@embedFile("foo");

or something like that. i don't remember the precise API for addAnonymousImport

fathom light
#

Thanks @mint quest that worked. Should I make an issue in the zig repo to add a tip to the error: error: embed of file outside package path... ? That makes it easy for others to find this information.

mint quest
#

(im not a core team member, so feel free to ignore my opinions), but i think that's unlikely to be accepted. the problem is more in documentation, not in the compiler

fathom light
#

I'm going to do it, I'm feeling lucky today :p