Skip to content

The included directory is not registered as a build dependency #120

Description

@maurges

Here's a minimal example:

fn main() {
    static FILES: include_dir::Dir =
        include_dir::include_dir!("$CARGO_MANIFEST_DIR/files");
    for file in FILES.entries().iter() {
        println!("{:?} {:?}", file.path(), file.as_file().map(|f| f.contents_utf8()))
    }
}

I then mkdir files and add a couple of files:

> echo foo > files/foo
> echo bar > files/bar

After the first build, the files are shown as expected:

> cargo run
"bar" Some(Some("bar\n"))
"foo" Some(Some("foo\n"))

Modifying the file will recompile as expected:

> echo 'not bar' > files/bar && cargo run
"bar" Some(Some("not bar\n"))
"foo" Some(Some("foo\n"))

But adding a new file will not recompile:

> echo 'kek' > files/kek && cargo run
"bar" Some(Some("not bar\n"))
"foo" Some(Some("foo\n"))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions