| 206 | |
| 207 | fn copy_dir_all(src: impl AsRef<Path>, dst: impl AsRef<Path>) -> Result<()> { |
| 208 | fn check_dir_all(src: impl AsRef<Path>, dst: impl AsRef<Path>) -> Result<()> { |
| 209 | if !dst.as_ref().exists() { |
| 210 | return Ok(()); |
| 211 | } |
| 212 | |
| 213 | for src_entry in fs::read_dir(src)? { |
| 214 | let src_entry = src_entry?; |
| 215 | let dst_path = dst.as_ref().join(src_entry.file_name()); |
| 216 | let entry_type = src_entry.file_type()?; |
| 217 | |
| 218 | if entry_type.is_dir() { |
| 219 | check_dir_all(src_entry.path(), dst_path)?; |
| 220 | } else if entry_type.is_file() { |
| 221 | if dst_path.exists() { |
| 222 | warn!( |
| 223 | "{} {}", |
| 224 | style("File already exists:").bold().red(), |
| 225 | style(dst_path.display()).bold().red(), |
| 226 | ) |
| 227 | } |
| 228 | } else { |
| 229 | warn!("{}", style("Symbolic links not supported").bold().red(),) |
| 230 | } |
| 231 | } |
| 232 | Ok(()) |
| 233 | } |
| 234 | fn copy_all(src: impl AsRef<Path>, dst: impl AsRef<Path>) -> Result<()> { |
| 235 | fs::create_dir_all(&dst)?; |
| 236 | for src_entry in fs::read_dir(src)? { |