Copy files with tour init

This commit is contained in:
2026-02-18 17:37:01 +00:00
parent efa297a07a
commit 7aa3ca651e
4 changed files with 31 additions and 2 deletions

19
src/utils.rs Normal file
View File

@@ -0,0 +1,19 @@
use std::fs;
use std::io;
use std::path::Path;
pub fn copy_files(files: Vec<&Path>, dest_dir: &Path) -> Result<(), io::Error> {
for file in files {
// Get the relative path components
let dest_path = dest_dir.join(file);
// Create parent directories if they don't exist
if let Some(parent) = dest_path.parent() {
fs::create_dir_all(parent)?;
}
// Copy the file
fs::copy(file, dest_path)?;
}
Ok(())
}