Skip to content

Conversation

@dennisdoomen
Copy link
Owner

@dennisdoomen dennisdoomen commented Aug 9, 2025

This pull request introduces a new utility to the ChainablePath API 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 the FindFirst methods (supporting both string and ChainablePath inputs), updates to the public API, and new tests to ensure correct behavior.

New API functionality

  • Added two overloads of ChainablePath.FindFirst: one accepting an array of strings and one accepting an array of ChainablePath objects. These methods return the first path that exists, or ChainablePath.Empty if none exist, and throw exceptions for null or empty arguments.
  • Updated the public API files for all supported target frameworks to include the new methods FromFirstExisting(params Pathy.ChainablePath[] paths) and FromFirstExisting(params string[] paths). [1] [2]

Test coverage

  • Added a comprehensive set of tests in ChainablePathSpecs.cs to verify the new FindFirst functionality, covering cases for files and directories, string and ChainablePath overloads, non-existing paths, null/empty input handling, and usage examples.

Code and test cleanup

  • Standardized the use of the directory separator character by renaming the slash field to Slash and 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

  • Added 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.

@github-actions
Copy link

github-actions bot commented Aug 9, 2025

Test Results

76 tests  +20   72 ✅ +17   0s ⏱️ ±0s
 3 suites + 2    0 💤 ± 0 
 3 files   + 2    4 ❌ + 3 

For more details on these failures, see this check.

Results for commit 60a60be. ± Comparison against base commit 587940e.

♻️ This comment has been updated with latest results.

@dennisdoomen dennisdoomen force-pushed the copilot/fix-45 branch 3 times, most recently from 60a60be to 26781f6 Compare August 9, 2025 19:57
@dennisdoomen dennisdoomen marked this pull request as ready for review August 9, 2025 19:58
@dennisdoomen dennisdoomen requested a review from Copilot August 9, 2025 19:58
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a new FindFirst utility method to the ChainablePath API that finds the first existing path from a list of candidates, with comprehensive test coverage and code cleanup improvements.

  • Added FindFirst methods with overloads for both string arrays and ChainablePath arrays
  • Updated public API documentation across all target frameworks to include the new methods
  • Standardized the directory separator field naming from slash to Slash for consistency

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

File Description
README.md Updated documentation with improved code examples and usage of the new FindFirst method
Pathy/ChainablePath.cs Added two FindFirst method overloads with comprehensive documentation and error handling
Pathy.Specs/ChainablePathSpecs.cs Added extensive test coverage for FindFirst functionality and updated field naming
API verification files Updated public API definitions to include the new FindFirst methods

@dennisdoomen dennisdoomen enabled auto-merge (rebase) August 9, 2025 20:01
@dennisdoomen dennisdoomen merged commit 591e917 into main Aug 9, 2025
2 checks passed
@dennisdoomen dennisdoomen deleted the copilot/fix-45 branch August 9, 2025 20:02
@dennisdoomen dennisdoomen added the enhancement New feature or request label Aug 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants