-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.rs
More file actions
24 lines (21 loc) · 706 Bytes
/
Copy pathbuild.rs
File metadata and controls
24 lines (21 loc) · 706 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
use anyhow::*;
use fs_extra::copy_items;
use fs_extra::dir::CopyOptions;
use std::env;
use std::result::Result::Ok;
fn main() -> Result<()> {
for entry in glob::glob("res/**/*").expect("failed to read res/ glob :(") {
match entry {
Ok(path) => println!("cargo::rerun-if-changed={}", path.display()),
Err(e) => eprintln!("glob error: {}", e),
}
}
println!("cargo::rerun-if-changed=res");
let out_dir = env::var("OUT_DIR")?;
let mut copy_options = CopyOptions::new();
copy_options.overwrite = true;
let mut paths_to_copy = Vec::new();
paths_to_copy.push("res/");
copy_items(&paths_to_copy, out_dir, ©_options)?;
Ok(())
}