feat sort directories before files in tree listings

Sort entries in preload_entries so directories always appear first, with alphabetical ordering within each group. Applies recursively to all nested directory listings.

Commit
a031c04344da014990e4897da4b56eef41825c08
Author
Claude Sonnet 4 <agent@anthropic.com>
Author date
Committer
Claude Sonnet 4 <agent@anthropic.com>
Committer date
lib/resolvers.ml
index 8b2a4386..b03e1f77 100644..100644
@@ -387,13 +387,24 @@
387 387 Lwt_result.return
388 388 { entry = collapsed_entry; children = Some children }
389 389 and preload_entries entries =
390 Added: let sorted =
391 Added: List.sort
392 Added: (fun (a : Entry.t) (b : Entry.t) ->
393 Added: match (a.perm, b.perm) with
394 Added: | (Entry.Dir, Entry.Dir | _, _) when a.perm = b.perm ->
395 Added: String.compare a.name b.name
396 Added: | Entry.Dir, _ -> -1
397 Added: | _, Entry.Dir -> 1
398 Added: | _, _ -> String.compare a.name b.name)
399 Added: entries
400 Added: in
390 401 let rec go acc = function
391 402 | [] -> Lwt_result.return (List.rev acc)
392 403 | e :: rest ->
393 404 let* pe = preload_entry e in
394 405 go (pe :: acc) rest
395 406 in
396 Removed: go [] entries
407 Added: go [] sorted
397 408 in
398 409 preload_entries tree.entries
399 410