in src/llvm_tools.rs [260:295]
fn copy_fixture(fixture: &str) -> TempDir {
let tmp_dir = tempfile::tempdir().expect("Failed to create temporary directory");
let tmp_path = tmp_dir.path();
let fixture_path = Path::new(FIXTURES_BASE).join(fixture);
let mut entries = VecDeque::new();
entries.push_front(fixture_path.clone());
while let Some(entry) = entries.pop_back() {
for item in WalkDir::new(&entry) {
let Ok(item) = item else {
continue;
};
if item.path() == entry {
continue;
}
let new_tmp = tmp_path.join(
item.path()
.strip_prefix(fixture_path.clone())
.expect("prefix should be fixture path"),
);
if item.path().is_file() {
// regular file
fs::copy(item.path(), new_tmp).expect("Failed to copy file to tmp dir");
} else {
// directory
fs::create_dir_all(new_tmp).expect("Failed to create dir");
entries.push_front(item.path().to_path_buf());
}
}
}
tmp_dir
}