mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 10:46:33 +02:00
[Chore] System.IO.Abstractions update (#21061)
* System.IO.Abstractions update * fix tests
This commit is contained in:
committed by
GitHub
parent
1c264e0899
commit
887da6dc1a
@@ -54,7 +54,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="JetBrains.Annotations" Version="2021.3.0" />
|
||||
<PackageReference Include="System.IO.Abstractions" Version="12.2.5" />
|
||||
<PackageReference Include="System.IO.Abstractions" Version="17.2.3" />
|
||||
<PackageReference Include="System.Runtime" Version="4.3.1" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
@@ -12,23 +12,27 @@ namespace Microsoft.Plugin.Folder.Sources
|
||||
public class QueryFileSystemInfo : IQueryFileSystemInfo
|
||||
{
|
||||
private readonly IDirectoryInfoFactory _directoryInfoFactory;
|
||||
private readonly MatchType _matchType;
|
||||
private readonly FileAttributes _attributesToSkip;
|
||||
|
||||
public QueryFileSystemInfo(IDirectoryInfoFactory directoryInfoFactory)
|
||||
public QueryFileSystemInfo(IDirectoryInfoFactory directoryInfoFactory, MatchType matchType = MatchType.Win32, FileAttributes attributesToSkip = FileAttributes.Hidden)
|
||||
{
|
||||
_directoryInfoFactory = directoryInfoFactory;
|
||||
_matchType = matchType;
|
||||
_attributesToSkip = attributesToSkip;
|
||||
}
|
||||
|
||||
public IEnumerable<DisplayFileInfo> MatchFileSystemInfo(string search, string incompleteName, bool isRecursive)
|
||||
{
|
||||
// search folder and add results
|
||||
var directoryInfo = _directoryInfoFactory.FromDirectoryName(search);
|
||||
var fileSystemInfos = directoryInfo.EnumerateFileSystemInfos(incompleteName, new EnumerationOptions()
|
||||
var fileSystemInfos = directoryInfo.EnumerateFileSystemInfos(incompleteName, new EnumerationOptions
|
||||
{
|
||||
MatchType = MatchType.Win32,
|
||||
MatchType = _matchType,
|
||||
RecurseSubdirectories = isRecursive,
|
||||
IgnoreInaccessible = true,
|
||||
ReturnSpecialDirectories = false,
|
||||
AttributesToSkip = FileAttributes.Hidden,
|
||||
AttributesToSkip = _attributesToSkip,
|
||||
MatchCasing = MatchCasing.PlatformDefault,
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user