You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
1.2 KiB
Rust
33 lines
1.2 KiB
Rust
|
|
use std::{env, fs, path::Path};
|
|
|
|
fn main()
|
|
{
|
|
// let out_dir = env::var("OUT_DIR").unwrap();
|
|
// let cwd = env::var("CARGO_MANIFEST_DIR").unwrap();
|
|
// println!("CWD: {}\n", cwd);
|
|
// let data_dir = cwd + "\\data";
|
|
// let data_path = Path::new(&data_dir);
|
|
// println!("Data path: {}", data_path.to_string_lossy());
|
|
|
|
// let data_path = Path::new("data/test_input");
|
|
|
|
// let out_dir = env::var("OUT_DIR").unwrap();
|
|
// panic!("out_dir: {}", out_dir);
|
|
let out_path = format!("../../target/{}", &env::var("PROFILE").unwrap());
|
|
let out_path = Path::new(&out_path);
|
|
//let out_path = Path::new(&out_dir).join(&env::var("PROFILE").unwrap());
|
|
let out_path_data = out_path.join(Path::new("data"));
|
|
|
|
if !out_path_data.exists()
|
|
{
|
|
fs::create_dir(&out_path_data).expect(&format!("Could not create data directory at: {}", out_path_data.to_string_lossy()));
|
|
}
|
|
|
|
for file in fs::read_dir("data").unwrap()
|
|
{
|
|
let file = file.unwrap();
|
|
let dest = out_path.join(file.path());
|
|
fs::copy(file.path(), &dest).expect(&format!("Could not copy file {} to {}", file.path().to_string_lossy(), dest.to_string_lossy()));
|
|
}
|
|
} |