diff options
| author | dkanada <dkanada@users.noreply.github.com> | 2020-06-28 04:32:23 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-06-28 04:32:23 +0900 |
| commit | c521ce412ca24b034ea0fba7387b5309cb7099e6 (patch) | |
| tree | 5a3d2329073ab57fb2a5b73fb3075366e2dd7b09 | |
| parent | dc2fc4ea168c9cbf85c843d23221e1cb75c1b834 (diff) | |
| parent | cb193b6afd339ab62a76644e02e9459962756c00 (diff) | |
Merge pull request #3461 from Bond-009/readonlyspan
Add support for ReadOnlySpan<char> in IgnorePatterns
| -rw-r--r-- | Emby.Server.Implementations/Library/IgnorePatterns.cs | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/Emby.Server.Implementations/Library/IgnorePatterns.cs b/Emby.Server.Implementations/Library/IgnorePatterns.cs index cd5c5f19d..6e6ef1359 100644 --- a/Emby.Server.Implementations/Library/IgnorePatterns.cs +++ b/Emby.Server.Implementations/Library/IgnorePatterns.cs @@ -1,3 +1,6 @@ +#nullable enable + +using System; using System.Linq; using DotNet.Globbing; @@ -88,9 +91,18 @@ namespace Emby.Server.Implementations.Library /// </summary> /// <param name="path">The path to test.</param> /// <returns>Whether to ignore the path.</returns> - public static bool ShouldIgnore(string path) + public static bool ShouldIgnore(ReadOnlySpan<char> path) { - return _globs.Any(g => g.IsMatch(path)); + int len = _globs.Length; + for (int i = 0; i < len; i++) + { + if (_globs[i].IsMatch(path)) + { + return true; + } + } + + return false; } } } |
