Clean up a directory on error (e.g., failed clone). Silently removes the directory and all its contents. Does nothing if the path doesn't exist. # Arguments `path` - The directory to remove
(path: &Path)
| 504 | /// |
| 505 | /// * `path` - The directory to remove |
| 506 | pub fn cleanup_on_error(path: &Path) { |
| 507 | if path.exists() { |
| 508 | let _ = std::fs::remove_dir_all(path); |
| 509 | } |
| 510 | } |
| 511 | |
| 512 | pub fn format_bytes(bytes: u64) -> String { |
| 513 | const KB: u64 = 1024; |