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.
Advent_of_Code/day_2/build.rs

21 lines
676 B
Rust

2 years ago
use std::{env, fs, path::Path};
fn main()
{
let out_path = format!("target/{}", &env::var("PROFILE").unwrap());
let out_path = Path::new(&out_path);
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()));
}
}