| 93 | |
| 94 | impl DirectoryListing { |
| 95 | fn read(directory: &Path) -> io::Result<Self> { |
| 96 | let mut listing = Self::default(); |
| 97 | for entry in fs::read_dir(directory)? { |
| 98 | let name = entry?.file_name(); |
| 99 | if let Some(text) = name.to_str() { |
| 100 | if !is_nfc(text) { |
| 101 | listing.composed.insert(text.nfc().collect(), name.clone()); |
| 102 | } |
| 103 | } |
| 104 | listing.names.insert(name); |
| 105 | } |
| 106 | Ok(listing) |
| 107 | } |
| 108 | |
| 109 | /// The on-disk spelling of `name`: the same bytes, or the entry whose |
| 110 | /// composed form equals `name`'s composed form. |