ctranslate2-src-build-support 0.1.2

Build support for ctranslate2-src
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use std::{fs, path::Path};

pub fn watch_dir_recursively(dir: &Path) {
    for entry in fs::read_dir(dir)
        .map(|v| v.collect::<Vec<_>>())
        .unwrap_or_default()
    {
        let entry = entry.expect("Failed to read entry");
        let path = entry.path();

        if path.is_file() {
            println!("cargo:rerun-if-changed={}", path.display());
        } else if path.is_dir() {
            watch_dir_recursively(&path);
        }
    }
}