Class EmptyFolderChainPruner
Deletes an ancestor folder chain from a leaf upward, one folder at a time, stopping at the first
folder that still holds something (or at PruneUpward(string, string)'s own stop boundary) — the shared
cleanup a test fixture uses after removing the one asset it created into a shared conventional folder
it owns no redirect seam for (InstallTaskAuthoring.ResolveDefaultTaskFolder's real-project
fallback, for instance). Order-independent by design: it prunes whatever is EMPTY right now rather
than tracking which folder a specific test call created, so two independent test fixtures sharing the
same conventional folder never leave residue depending on which one happens to run last in a suite.
Deliberately its own type rather than a test-side call into the production
Serenity.Global.Infrastructure.Editor.Utils.SerenityEmptyFolderPruner: that pruner (a) only
deletes a folder from a caller-supplied "folders THIS run created" set, which is exactly the
order-dependent tracking this type exists to avoid, and (b) tests emptiness via
AssetDatabase.FindAssets(string.Empty, ...), which still matches a folder's own just-emptied
index entry within the same synchronous pass — the real filesystem check in Serenity.Tests.Shared.Editor.EmptyFolderChainPruner.IsEmpty(System.String)
exists specifically because that AssetDatabase-based check reported a folder "occupied" immediately
after this exact kind of test-cleanup emptied it.
Inherited Members
Namespace: Serenity.Tests.Shared.Editor
Assembly: Serenity.Tests.Shared.Editor.dll
Syntax
public static class EmptyFolderChainPruner
Methods
PruneUpward(string, string)
Deletes leafFolderPath and each ancestor above it while each is empty, stopping
at the first non-empty folder or at stopAtFolderPathExclusive (never deleted
itself, e.g. the project's "Assets" root).
Declaration
public static void PruneUpward(string leafFolderPath, string stopAtFolderPathExclusive)
Parameters
| Type | Name | Description |
|---|---|---|
| string | leafFolderPath | |
| string | stopAtFolderPathExclusive |