#How to use examples dir in library build.zig

1 messages · Page 1 of 1 (latest)

torpid crescent
#

How do I reference a subdirectory when trying to open an examples/ dir with examples for my library? It worked locally when I just opened cwd() and accessed "examples/" but fails when using the library as a dependency.

https://zigbin.io/613b29

ripe burrow
#

if the dir is not listed in .paths in its own build.zig.zon then it wont be included when downloading the dependency

torpid crescent
#

I already added it

#

That didn't seem to fix my problem

#

I ended up just writing a list of files in my examples dir and using that instead of traversing lol

ripe burrow
#

yeah i would recomended that solution
but it sounded like you couldnt access examples at all

torpid crescent
#

It let me access them, I just wasn't sure how I convert a LazyPath to something I can access

#

So then I could just do b.path("examples") and somehow use that

ripe burrow
#

ah you shouldnt do io in the build.zig, especially after the changes on master

#

which is why listing the examples out is recomended