embedFile refuses to load file in src

Hello, I’m trying to make my Advent of Code setup. I wanted to make use of @embedFile to ease input loading, however it is complaining about the file being outside of src;

This is my directory:

.
├── build.zig
├── fetch.sh
├── input
│   ├── 2024
│   └── 2025
└── src
    ├── data
    │   └── day01.txt
    └── days
        └── day01.zig

Here is build.zig:

const std = @import("std");

pub fn build(b: *std.Build) void {
    const exe = b.addExecutable(.{
        .name = "hello",
        .root_module = b.createModule(.{
            .root_source_file = b.path("src/days/day01.zig"),
            .target = b.graph.host,
        }),
    });

    b.installArtifact(exe);

    const run_exe = b.addRunArtifact(exe);

    const run_step = b.step("run", "Run the application");
    run_step.dependOn(&run_exe.step);
}

You can add the file you want to embed as an import and use @embedFile("importname");

1 Like

It worked, thanks!