Needed this to initialize a project in an already-initialized template at a fixed path in Foundry tests, basically:
/// Initializes a new project in the given directory.
pub fn initialize(at: &Path) {
let global_path = Path::new("/tmp/my_template/");
let project = MyProject::new_with_root(global_path); // Wraps TempProject
if project.is_empty() { // std::fs::read_dir or whatever
project.initialize().unwrap();
}
project.copy_to(at).unwrap();
// can also return a new project here
// Project::new_with_root(at)
}
Needed this to initialize a project in an already-initialized template at a fixed path in Foundry tests, basically: