WildPath 0.1.5

dotnet add package WildPath --version 0.1.5
                    
NuGet\Install-Package WildPath -Version 0.1.5
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="WildPath" Version="0.1.5" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="WildPath" Version="0.1.5" />
                    
Directory.Packages.props
<PackageReference Include="WildPath" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add WildPath --version 0.1.5
                    
#r "nuget: WildPath, 0.1.5"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package WildPath@0.1.5
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=WildPath&version=0.1.5
                    
Install as a Cake Addin
#tool nuget:?package=WildPath&version=0.1.5
                    
Install as a Cake Tool

<div align = "center">

WildPath

WildPath

NuGet NuGet License PR Welcome

.NET library for advanced file-system path expression resolution.

</div>

Features

  • Advanced Wildcard Matching:
    • Supports wildcards (* and **) for flexible directory and file searches. (e.g., a\**\).
  • Parent Traversal:
    • Use .. to navigate to the parent directory and ... to recursively traverse all parent directories.
  • Exact Matching:
    • Match specific directories by name.
  • Tagged Search:
    • Identify directories containing a marker file or subdirectory. (e.g., a\:tagged(.marker)\b).
  • Composable Expressions:
    • Combine strategies for complex path resolutions, such as ...\\**\\kxd.
  • Plugins:
    • Extend functionality with custom path resolvers and matchers.

Showcase

ezgif-4-c156370953


Installation

WildPath is available as a NuGet package. You can install it using the .NET CLI or through the NuGet Package Manager in Visual Studio.

.NET CLI

dotnet add package WildPath

Package Manager

Install-Package WildPath

Alternatively, you can clone the repository and build the project manually:

  1. Clone the repository:
git clone https://github.com/JKamsker/WildPath.git
  1. Build the project using your favorite IDE or CLI:
dotnet build

For more details, visit the NuGet package page.


Usage

Basic Path Matching

using WildPath;

var result = PathResolver.Resolve("SubDir1\\SubSubDir1");
Console.WriteLine(result);
// Output (assuming current directory = "C:\\Test"): "C:\\Test\\SubDir1\\SubSubDir1"

Find a directory named kxd:

var result = PathResolver.Resolve("...\\**\\kxd");
// Output: "C:\\Test\\SubDir1\\SubSubDir1\\bin\\Debug\\kxd"

Find a directory containing .marker and a specific subpath:

var result = PathResolver.Resolve("**\\:tagged(.marker):\\bin\\Debug");
// Output: "C:\\Test\\SubDir2\\SubSubDir1\\bin\\Debug"

Customized Path Resolution

To use a custom current directory, separator or even a different file system, you can new up a PathResolver and use the same API:

using WildPath;

var currentDir = "C:\\Test";
var expression = "SubDir1\\SubSubDir1";

var resolver = new PathResolver(currentDir);
var result = resolver.Resolve(expression);
Console.WriteLine(result); // Output: "C:\\Test\\SubDir1\\SubSubDir1"

Plugins

Here you can find an example of how to create and use a custom plugin.


Expression Syntax

Symbol Description
* Matches any single directory name.
** Matches directories recursively.
.. Moves to the parent directory.
... Recursively traverses all parent directories.
:tagged(x) Matches directories containing a file or folder named x.

Testing

Run the test suite to validate functionality:

dotnet test

Example tests include:

  1. Wildcard and parent traversal.
  2. Directory matching with markers.

Contributing

  1. Fork the repository.
  2. Create a new branch:
    git checkout -b feature-name
    
  3. Commit your changes and push to your fork:
    git commit -m "Description of feature"
    git push origin feature-name
    
  4. Submit a pull request.

Todo

Limit recursive search depth:

  • ...{1,3}\\**{1,3}\\:tagged(testhost.exe):\\fr should only search 1-3 directories deep.
  • ...{4}\\**{4}\\:tagged(testhost.exe):\\fr should only search 4 directories deep.

Add cancellation token support

Like seriously, this libaray begs for being ddosed.

Not as serious todos:

Search by file content:

Be a little cray cray

  • ...\\**\\:content(test.json, test): should search for files containing the string "test".

Seach within zip files:

  • ...\\**\\:zip(test.zip):\\fr should search for files within a zip file named "test.zip".

License

This project is licensed under the MIT License.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 is compatible.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.5 0 12/29/2025
0.1.4 0 12/29/2025
0.1.3 0 12/29/2025
0.0.6 1,992 12/12/2024
0.0.5 141 12/11/2024
0.0.4 184 12/11/2024
0.0.3 174 12/11/2024
0.0.2 169 12/11/2024
0.0.1 170 12/11/2024