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"))
Here's a minimal example:
I then
mkdir filesand add a couple of files:After the first build, the files are shown as expected:
Modifying the file will recompile as expected:
But adding a new file will not recompile: