WildPath is a library for advanced file-system path resolution, with pattern matching and dynamic traversal capabilities.
$ dotnet add package WildPath* and **) for flexible directory and file searches. (e.g., a\**\)... to navigate to the parent directory and ... to recursively traverse all parent directories.a\:tagged(.marker)\b)....\\**\\kxd.WildPath is available as a NuGet package. You can install it using the .NET CLI or through the NuGet Package Manager in Visual Studio.
dotnet add package WildPath
Install-Package WildPath
Alternatively, you can clone the repository and build the project manually:
git clone https://github.com/JKamsker/WildPath.git
dotnet build
For more details, visit the NuGet package page.
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"
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"
Here you can find an example of how to create and use a custom plugin.
| 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. |
Run the test suite to validate functionality:
dotnet test
Example tests include:
git checkout -b feature-name
git commit -m "Description of feature"
git push origin feature-name
...{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.Like seriously, this libaray begs for being ddosed.
Be a little cray cray
...\\**\\:content(test.json, test): should search for files containing the string "test"....\\**\\:zip(test.zip):\\fr should search for files within a zip file named "test.zip".This project is licensed under the MIT License.