Added FindFirst to find the first file or directory matching a specification #50
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request introduces a new utility to the
ChainablePathAPI for finding the first existing path from a list of candidates, along with comprehensive unit tests and minor code cleanups. The most significant changes are the addition of theFindFirstmethods (supporting both string andChainablePathinputs), updates to the public API, and new tests to ensure correct behavior.New API functionality
ChainablePath.FindFirst: one accepting an array of strings and one accepting an array ofChainablePathobjects. These methods return the first path that exists, orChainablePath.Emptyif none exist, and throw exceptions for null or empty arguments.FromFirstExisting(params Pathy.ChainablePath[] paths)andFromFirstExisting(params string[] paths). [1] [2]Test coverage
ChainablePathSpecs.csto verify the newFindFirstfunctionality, covering cases for files and directories, string andChainablePathoverloads, non-existing paths, null/empty input handling, and usage examples.Code and test cleanup
slashfield toSlashand updating all usages to the new static field for improved code clarity and consistency. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]Minor improvements
using System.Linq;where needed to support the new functionality. [1] [2]These changes make it easier to work with multiple potential file or directory paths by providing a simple, robust way to select the first one that exists.…ication.