diff --git a/README.md b/README.md
index 196e44a..0259694 100644
--- a/README.md
+++ b/README.md
@@ -21,11 +21,11 @@ The `IsMatch` method attempts to match the specified path against the provided w
By default, the system's default path separators are used. You can override this behavior by specifying one of the following flags:
-| Name | Description |
-|---------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
-| Auto | Automatically determines whether to treat backslashes (`\ `) as escape sequences or path separators based on the platform's separator convention. |
-| Windows | Treats backslashes (`\ `) as path separators instead of escape sequences.
Provides behavior consistent with Windows-style paths.
Both backslashes (`\ `) and forward slashes (`/`) are considered as path separators in this mode. |
-| Unix | Treats backslashes (`\ `) as escape sequences, allowing for special character escaping.
Provides behavior consistent with Unix-style paths. |
+| Name | Description |
+|---------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| Auto | Automatically determines whether to treat backslashes (`\`) as escape sequences or path separators based on the platform's separator convention. |
+| Windows | Treats backslashes (`\`) as path separators instead of escape sequences.
Provides behavior consistent with Windows-style paths.
Both backslashes (`\`) and forward slashes (`/`) are considered as path separators in this mode. |
+| Unix | Treats backslashes (`\`) as escape sequences, allowing for special character escaping.
Provides behavior consistent with Unix-style paths. |
Example with a specific flag:
```csharp
@@ -45,7 +45,7 @@ From [Wikipedia](https://en.wikipedia.org/wiki/Glob_(programming)#Syntax)
| [!abc] | matches one character that is not given in the bracket | [!C]at | Bat, bat, or cat | Cat |
| [!a-z] | matches one character that is not from the range given in the bracket | Letter[!3-5] | Letter1, Letter2, Letter6 up to Letter9 and Letterx etc. | Letter3, Letter4, Letter5 or Letterxx |
-### Pattern specific for directories
+### Pattern-specific for directories
| Pattern | Description | Example | Matches | Does not match |
|---------|-----------------------------------------------------|---------|--------------------------------|----------------|
@@ -68,7 +68,7 @@ Brace patterns allow for matching multiple alternatives in a single pattern. Her
## Escaping characters
-The meta characters `?`, `*`, `[`, `\ ` can be escaped by using the `[]`, which means *match one character listed in the bracket*.
+The meta characters `?`, `*`, `[`, `\` can be escaped by using the `[]`, which means *match one character listed in the bracket*.
* `[[]` matches the literal `[`
* `[*]` matches the literal `*`
@@ -217,9 +217,9 @@ await foreach (string filePath in enumeration)
## Supported versions
-| | Version |
-|------|------------|
-| .NET | 6, 7, 8, 9 |
+| | Version |
+|------|----------------|
+| .NET | 6, 7, 8, 9, 10 |
## Contributions
diff --git a/Ramstack.Globbing.sln b/Ramstack.Globbing.sln
deleted file mode 100644
index 6d7b975..0000000
--- a/Ramstack.Globbing.sln
+++ /dev/null
@@ -1,38 +0,0 @@
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio Version 17
-VisualStudioVersion = 17.11.35017.193
-MinimumVisualStudioVersion = 10.0.40219.1
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ramstack.Globbing", "Ramstack.Globbing\Ramstack.Globbing.csproj", "{75C64110-8F7B-4485-B799-ACDB564B20D8}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ramstack.Globbing.Tests", "Ramstack.Globbing.Tests\Ramstack.Globbing.Tests.csproj", "{01989D6A-5F3D-4861-B62E-63DCD5053EC2}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{259E3BAB-CA31-4244-9B91-E296826841F7}"
- ProjectSection(SolutionItems) = preProject
- .editorconfig = .editorconfig
- .gitignore = .gitignore
- LICENSE = LICENSE
- README.md = README.md
- EndProjectSection
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Any CPU = Debug|Any CPU
- Release|Any CPU = Release|Any CPU
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {75C64110-8F7B-4485-B799-ACDB564B20D8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {75C64110-8F7B-4485-B799-ACDB564B20D8}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {75C64110-8F7B-4485-B799-ACDB564B20D8}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {75C64110-8F7B-4485-B799-ACDB564B20D8}.Release|Any CPU.Build.0 = Release|Any CPU
- {01989D6A-5F3D-4861-B62E-63DCD5053EC2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {01989D6A-5F3D-4861-B62E-63DCD5053EC2}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {01989D6A-5F3D-4861-B62E-63DCD5053EC2}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {01989D6A-5F3D-4861-B62E-63DCD5053EC2}.Release|Any CPU.Build.0 = Release|Any CPU
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
- GlobalSection(ExtensibilityGlobals) = postSolution
- SolutionGuid = {449CB7E2-8227-4220-94D5-301CB5CC4EBC}
- EndGlobalSection
-EndGlobal
diff --git a/Ramstack.Globbing.slnx b/Ramstack.Globbing.slnx
new file mode 100644
index 0000000..fba84cf
--- /dev/null
+++ b/Ramstack.Globbing.slnx
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/Ramstack.Globbing/Matcher.cs b/Ramstack.Globbing/Matcher.cs
index f77c32e..c872d99 100644
--- a/Ramstack.Globbing/Matcher.cs
+++ b/Ramstack.Globbing/Matcher.cs
@@ -57,7 +57,7 @@ namespace Ramstack.Globbing;
public static unsafe class Matcher
{
///
- /// Represents a marker structure that is used to indicate that the '\' character
+ /// Represents a marker structure used to indicate that the '\' character
/// should be treated as an escape character in the context of glob pattern processing.
/// This enables the JIT compiler to generate optimized versions of functions
/// for different options, enhancing performance.
@@ -65,7 +65,7 @@ public static unsafe class Matcher
private readonly struct Unix;
///
- /// Represents a marker structure that is used to indicate that the escape character '\'
+ /// Represents a marker structure used to indicate that the escape character '\'
/// should not be treated as an escape character, but as a path separator instead,
/// in the context of glob pattern processing.
/// This enables the JIT compiler to generate optimized versions of functions
@@ -257,7 +257,7 @@ static int Length(char* s, char* e)
// 2. At any deeper level (level > 0), an empty segment indicates that a required directory or file is missing,
// making the path invalid for patterns expecting something at that level.
//
- // For example:
+ // For example
// Pattern: "*/*" and path: "a" - This pattern requires at least one directory level, so "a" is not a match.
// Pattern: "*/{,b}" and path: "a" - Similarly, this pattern requires a directory or a specific file ("b")
// at the next level, so "a" doesn't match.
@@ -356,10 +356,11 @@ static int Length(char* s, char* e)
case '*':
{
- // *** --> *
+ // *** => *
// Treats consecutive stars as one
+ // ReSharper disable once RedundantJumpStatement
while (++p < pend && p[0] == '*')
- continue; // ReSharper disable once RedundantJumpStatement
+ continue;
// Trailing '*' matches everything
if (p == pend)
diff --git a/Ramstack.Globbing/Traversal/Files.Utilities.cs b/Ramstack.Globbing/Traversal/Files.Utilities.cs
index fe3313b..58f29fe 100644
--- a/Ramstack.Globbing/Traversal/Files.Utilities.cs
+++ b/Ramstack.Globbing/Traversal/Files.Utilities.cs
@@ -138,6 +138,7 @@ private static int GetRelativePathLength(ref FileSystemEntry entry)
// This method is 47 bytes of IL code consisting solely of calls (6 calls),
// and JIT refuses to inline it, even though the x86-64 output results
// in a small set of instructions.
+
return entry.Directory.Length - entry.RootDirectory.Length + entry.FileName.Length + 1;
}
@@ -146,7 +147,7 @@ private static void UpdatePathSeparators(scoped Span path, MatchFlags flag
// To enable escaping in Windows systems, we convert backslashes (\) to forward slashes (/).
// This is safe because in Windows, backslashes are only used as path separators.
// Otherwise, the backslash (\) in the path will be treated as an escape character,
- // and as a result, the `Unix` flag will essentially not work on a Windows system.
+ // and as a result, the MatchFlags.Unix flag will essentially not work on a Windows system.
if (Path.DirectorySeparatorChar == '\\' && flags == MatchFlags.Unix)
PathHelper.ConvertPathToPosixStyle(path);
}