FindMyFiles

FindMyFiles.Services

ScopePaths Class

Pure path helpers for scope mode (ADR-0024/-0025). The engine treats scope roots as independent and would double-walk a nested pair, so the UI normalizes the chosen set; excludes must sit under a root to mean anything. No I/O — unit-tested directly.

public static class ScopePaths

Inheritance System.Object → ScopePaths

Methods

ScopePaths.IsUnderAnyRoot(string, IEnumerable<string>) Method

True when path sits strictly under one of roots — the guard for adding a scope exclude, which must be inside the indexed set to prune anything (ADR-0025). Excluding a whole root (equal path) is rejected: drop the root instead.

public static bool IsUnderAnyRoot(string path, System.Collections.Generic.IEnumerable<string> roots);

Parameters

path System.String

The candidate exclude path.

roots System.Collections.Generic.IEnumerable<System.String>

The selected scope roots.

Returns

System.Boolean
True when the path is a proper descendant of some root.

ScopePaths.Normalize(IEnumerable<string>) Method

Drop any root nested under another selected root (and exact case-insensitive duplicates), so e.g. {C:\A, C:\A\B} collapses to {C:\A}. The surviving roots keep their original strings (no trailing-separator rewriting — C:\ must stay C:\) and their first-seen order.

public static System.Collections.Generic.List<string> Normalize(System.Collections.Generic.IEnumerable<string> roots);

Parameters

roots System.Collections.Generic.IEnumerable<System.String>

The chosen roots, in selection order.

Returns

System.Collections.Generic.List<System.String>
The covering roots with nested/duplicate entries removed.