~/website

website/src/main.rs -rw-r--r-- 513 B
0f8635bc — arthurmelton move static to public 2 years ago
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use walkdir::WalkDir;
use std::fs;
use std::path::Path;

fn main() {
    let _ = fs::create_dir("public");
    for e in WalkDir::new("static").into_iter().filter_map(|e| e.ok()) {
        if e.metadata().unwrap().is_file() {
            let mut path = e.path();
            path = path.strip_prefix("static/").unwrap(); // should never fail
            fs::copy(e.path(), Path::new("public").join(path)).expect(&format!("failed to copy static/{} to public/{}", path.display(), path.display()));
        }
    }
}