pub fn process(name: &str, path: &str) {
    match name {
        "fmt" => {
            fix_fmt(path);
        }
        "zstd" => {
            fix_zstd(path);
        }
        _ => {}
    }
}

fn fix_fmt(path: &str) {
    let old_text = std::fs::read_to_string(path).unwrap();
    let new_text = old_text.replacen(
        r#"-DFMT_CMAKE_DIR=share/fmt"#,
        r#"-DFMT_CMAKE_DIR=share/${PORT}"#,
        1,
    );
    std::fs::write(path, new_text.as_bytes()).unwrap();
}

fn fix_zstd(path: &str) {
    let old_text = std::fs::read_to_string(path).unwrap();
    let new_text = old_text.replacen(
        r#"file(READ "${CURRENT_PACKAGES_DIR}/share/zstd/zstdTargets.cmake" targets)"#,
        r#"file(READ "${CURRENT_PACKAGES_DIR}/share/${PORT}/zstdTargets.cmake" targets)"#,
        1,
    );
    std::fs::write(path, new_text.as_bytes()).unwrap();
}
