| 56 | } |
| 57 | |
| 58 | fn walkdir(dir: &Path) -> std::io::Result<Vec<(String, Vec<u8>)>> { |
| 59 | let mut out = Vec::new(); |
| 60 | if dir.is_file() { |
| 61 | let relative = dir.to_string_lossy().into_owned(); |
| 62 | out.push((relative, fs::read(dir).unwrap_or_default())); |
| 63 | return Ok(out); |
| 64 | } |
| 65 | for entry in fs::read_dir(dir)? { |
| 66 | let entry = entry?; |
| 67 | let path = entry.path(); |
| 68 | if path.is_dir() { |
| 69 | out.extend(walkdir(&path)?); |
| 70 | } else { |
| 71 | let relative = path.to_string_lossy().into_owned(); |
| 72 | out.push((relative, fs::read(&path).unwrap_or_default())); |
| 73 | } |
| 74 | } |
| 75 | Ok(out) |
| 76 | } |
| 77 | |
| 78 | fn bytes_differ(before: &[(String, Vec<u8>)], after: &[(String, Vec<u8>)]) -> Vec<String> { |
| 79 | let mut differences = Vec::new(); |