Skip to main content

read_dir_sorted

Function read_dir_sorted 

Source
pub fn read_dir_sorted(dir: &Path) -> Result<Vec<DirEntry>>
Expand description

Read dir, sorted directories first, then alphabetically — the ordering both listings present and the one a user navigates by muscle memory.

Ordering is by name, not by path. Within a single directory the two agree, so this is not a behaviour change; naming the weaker key would just invite a future caller to pass entries from more than one directory and get a surprising order.

I/O errors propagate: a listing that silently dropped unreadable entries would show a directory that does not match the disk, and oil would then diff :w against that wrong picture.