-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Closed
Labels
C-bugCategory: bugCategory: bug
Description
Problem
I have a build-rs
that contains the following:
use std::fs::copy;
use std::io;
fn main() -> io::Result<()> {
println!("cargo:rerun-if-changed=res/*");
let out_dir = std::env::var("OUT_DIR").unwrap();
for x in std::fs::read_dir("res/")?
.filter_map(Result::ok)
.filter(|item| item.file_type().unwrap().is_file())
.map(|item| (item.path(), format!("{}/res/{}", out_dir, item.file_name()
.to_string_lossy()
.to_owned()
)))
.map(|(from, to)| {
println!("from: {:?}, to: {}", from, to);
copy(from, to)
})
{
x?;
}
Ok(())
}
Which should copy every file in the folder res
into $OUT_DIR/res
. However, when I try and build my project, I get an error:
error: failed to run custom build command for `gfx v0.1.0 (/home/violet/projects/gfx)`
Caused by:
process didn't exit successfully: `/home/violet/projects/gfx/target/debug/build/gfx-1385f1dbcfa44ce1/build-script-build` (exit code: 1)
--- stdout
cargo:rerun-if-changed=res/*
from: "res/cube-diffuse.jpg", to: /home/violet/projects/gfx/target/debug/build/gfx-52f2df593a0e8de1/out/res/cube-diffuse.jpg
which appears to show that what is contained in OUT_DIR
is incorrect.
Notes
I'm running Void Linux, and I'm using rustc version 1.51.0-nightly and cargo version 1.50.0-nightly.
Metadata
Metadata
Assignees
Labels
C-bugCategory: bugCategory: bug