MCPcopy Create free account
hub / github.com/TanTanDev/first_voxel_engine / copy_res

Function copy_res

build.rs:9–29  ·  view source on GitHub ↗

copy resource folder to OUT_DIR

()

Source from the content-addressed store, hash-verified

7
8// copy resource folder to OUT_DIR
9fn copy_res() -> Result<()> {
10 // This tells cargo to rerun this script if something in /res/ changes.
11 println!("cargo:rerun-if-changed=res/*");
12
13 let out_dir = env::var("OUT_DIR")?;
14 let out_dir = PathBuf::from(out_dir);
15 let out_dir = out_dir
16 .parent()
17 .unwrap()
18 .parent()
19 .unwrap()
20 .parent()
21 .unwrap();
22 println!("out dir: {:?}", out_dir);
23 let mut copy_options = CopyOptions::new();
24 copy_options.overwrite = true;
25 let mut paths_to_copy = Vec::new();
26 paths_to_copy.push("res/");
27 copy_items(&paths_to_copy, out_dir, &copy_options)?;
28 Ok(())
29}
30
31fn main() -> Result<()> {
32 copy_res()?;

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected