We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OUT_DIR
Problem
I have a build-rs that contains the following:
build-rs
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:
res
$OUT_DIR/res
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.
The text was updated successfully, but these errors were encountered:
fs::copy does not create intermediate directories. I don't see anything creating the res directory in OUT_DIR.
fs::copy
Also, FYI, rerun-if-changed does not support * globbing. A recent change (#8973) allows it to be a directory, which should be in the next beta.
rerun-if-changed
*
Sorry, something went wrong.
fs::copy does not create intermediate directories. I don't see anything creating the res directory in OUT_DIR. Also, FYI, rerun-if-changed does not support * globbing. A recent change (#8973) allows it to be a directory, which should be in the next beta.
ah thank you for the help :)
No branches or pull requests
Problem
I have a
build-rs
that contains the following: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: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.
The text was updated successfully, but these errors were encountered: