mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-12-21 07:17:56 +08:00
[PT Run][Folder] Use static SearchValues to resolve CA1870
This commit is contained in:
parent
720a503b6b
commit
6b6c0dd5e4
@ -3,6 +3,7 @@
|
|||||||
// See the LICENSE file in the project root for more information.
|
// See the LICENSE file in the project root for more information.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Buffers;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Immutable;
|
using System.Collections.Immutable;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
@ -15,6 +16,7 @@ namespace Microsoft.Plugin.Folder.Sources
|
|||||||
{
|
{
|
||||||
public class QueryInternalDirectory : IQueryInternalDirectory
|
public class QueryInternalDirectory : IQueryInternalDirectory
|
||||||
{
|
{
|
||||||
|
private static readonly SearchValues<char> PathChars = SearchValues.Create("\\/");
|
||||||
private readonly FolderSettings _settings;
|
private readonly FolderSettings _settings;
|
||||||
private readonly IQueryFileSystemInfo _queryFileSystemInfo;
|
private readonly IQueryFileSystemInfo _queryFileSystemInfo;
|
||||||
private readonly IDirectory _directory;
|
private readonly IDirectory _directory;
|
||||||
@ -51,7 +53,7 @@ namespace Microsoft.Plugin.Folder.Sources
|
|||||||
{
|
{
|
||||||
// if folder doesn't exist, we want to take the last part and use it afterwards to help the user
|
// if folder doesn't exist, we want to take the last part and use it afterwards to help the user
|
||||||
// find the right folder.
|
// find the right folder.
|
||||||
int index = search.LastIndexOfAny(new char[] { '\\', '/' });
|
int index = search.AsSpan().LastIndexOfAny(PathChars);
|
||||||
|
|
||||||
// No slashes found, so probably not a folder
|
// No slashes found, so probably not a folder
|
||||||
if (index <= 0 || index >= search.Length - 1)
|
if (index <= 0 || index >= search.Length - 1)
|
||||||
|
Loading…
Reference in New Issue
Block a user