embedding a non-existent file will fail;
_ = @embedFile("doesnotexist")
is there a way to try
and catch
this?
embedding a non-existent file will fail;
_ = @embedFile("doesnotexist")
is there a way to try
and catch
this?
try
/catch
are runtime things. This is a compile error.
uh right, seems I need to rethink my approach
A better approach might be to handle finding the file at build time, where you can use more of the runtime stdlib io (and thus try
/catch
). Then you would add the found files as anonymous imports/modules that can still be embedded using @embedFile("anon_mod_name")
.
The build guide shows some of this here which I think can be adapted to your needs.
discovered yesterday that @dude_the_builder made a related tutorial video (code gen) - very helpful