1 use std::fs::{copy, create_dir_all, read_dir};
3 use std::path::PathBuf;
4 use crate::template::TemplateContext;
6 fn recursively_copy(source: &PathBuf, target: &PathBuf) -> Result<()> {
7 let entries = read_dir(source)?;
10 let entry_type = entry.file_type()?;
11 let entry_name = entry.file_name();
12 let entry_source = entry.path();
13 let entry_target = target.join(entry_name);
15 if entry_type.is_dir() {
16 create_dir_all(&entry_target)?;
17 recursively_copy(&entry_source, &entry_target)?;
19 copy(&entry_source, &entry_target)?;
26 pub fn generate(source: &PathBuf, _: &PathBuf, target: &PathBuf, _: &TemplateContext) -> Result<()> {
28 return recursively_copy(source, target)