Recursively copies `src` into `dest`, preserving file mtimes so the staleness pipeline sees copied sources exactly as the template indexed them.
(src: &Path, dest: &Path)
| 346 | /// staleness pipeline sees copied sources exactly as the template indexed |
| 347 | /// them. |
| 348 | fn copy_tree(src: &Path, dest: &Path) -> io::Result<()> { |
| 349 | fs::create_dir_all(dest)?; |
| 350 | for entry in fs::read_dir(src)? { |
| 351 | let entry = entry?; |
| 352 | let from = entry.path(); |
| 353 | let to = dest.join(entry.file_name()); |
| 354 | if entry.file_type()?.is_dir() { |
| 355 | copy_tree(&from, &to)?; |
| 356 | } else { |
| 357 | copy_file_preserving_mtime(&from, &to)?; |
| 358 | } |
| 359 | } |
| 360 | Ok(()) |
| 361 | } |
| 362 | |
| 363 | fn copy_file_preserving_mtime(src: &Path, dest: &Path) -> io::Result<()> { |
| 364 | fs::copy(src, dest)?; |
no test coverage detected