Skip to main content

read_bynk_tree_split

Function read_bynk_tree_split 

Source
pub fn read_bynk_tree_split(
    trees: &[PathBuf],
    excludes: &[PathBuf],
) -> Result<HashMap<PathBuf, String>, DiscoveryError>
Expand description

read_bynk_tree merged across every one of a split project’s include roots, matching Roots::trees’ shape — the primary root’s paths.exclude (plus the tool’s own out/node_modules caches) applies to all of them.

R3.9 (#1113): walks every tree Roots::trees resolves to, not a hardcoded primary/secondary pair. trees[0] is mandatory (a missing directory is a real DiscoveryError, same as any other unreadable directory); every later tree is optional — a conventional src-only project simply has no tests/ at all — so only its absence is tolerated. Tried via read_bynk_tree itself (a fs::read_dir) and its NotFound caught for an optional tree, rather than a root.exists() pre-check, which would cost a redundant stat() per optional tree for the same answer.

Only a NotFound reported for the root itself is tolerated — matched by e.path == *root, true only for the walk’s very first fs::read_dir call. A NotFound for anything deeper (a dangling symlink, a subdirectory removed mid-walk) means the tree exists and had real files; swallowing that would silently discard everything read_bynk_tree had already collected for it, with no diagnostic — a review-caught defect in an earlier cut of this fix, which matched on the error’s io::ErrorKind alone regardless of which path it named.