mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-12-06 09:45:56 +01:00
Backport pull request #15582 from jellyfin/release-10.11.z
Add hidden file check in BdInfoDirectoryInfo.cs.
Original-merge: 29b3aa8543
Merged-by: crobibero <cody@robibe.ro>
Backported-by: Bond_009 <bond.009@outlook.com>
This commit is contained in:
parent
5d46278584
commit
ebcfed83c4
1 changed files with 7 additions and 0 deletions
|
|
@ -1,3 +1,4 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using BDInfo.IO;
|
||||
|
|
@ -58,6 +59,8 @@ public class BdInfoDirectoryInfo : IDirectoryInfo
|
|||
}
|
||||
}
|
||||
|
||||
private static bool IsHidden(ReadOnlySpan<char> name) => name.StartsWith('.');
|
||||
|
||||
/// <summary>
|
||||
/// Gets the directories.
|
||||
/// </summary>
|
||||
|
|
@ -65,6 +68,7 @@ public class BdInfoDirectoryInfo : IDirectoryInfo
|
|||
public IDirectoryInfo[] GetDirectories()
|
||||
{
|
||||
return _fileSystem.GetDirectories(_impl.FullName)
|
||||
.Where(d => !IsHidden(d.Name))
|
||||
.Select(x => new BdInfoDirectoryInfo(_fileSystem, x))
|
||||
.ToArray();
|
||||
}
|
||||
|
|
@ -76,6 +80,7 @@ public class BdInfoDirectoryInfo : IDirectoryInfo
|
|||
public IFileInfo[] GetFiles()
|
||||
{
|
||||
return _fileSystem.GetFiles(_impl.FullName)
|
||||
.Where(d => !IsHidden(d.Name))
|
||||
.Select(x => new BdInfoFileInfo(x))
|
||||
.ToArray();
|
||||
}
|
||||
|
|
@ -88,6 +93,7 @@ public class BdInfoDirectoryInfo : IDirectoryInfo
|
|||
public IFileInfo[] GetFiles(string searchPattern)
|
||||
{
|
||||
return _fileSystem.GetFiles(_impl.FullName, new[] { searchPattern }, false, false)
|
||||
.Where(d => !IsHidden(d.Name))
|
||||
.Select(x => new BdInfoFileInfo(x))
|
||||
.ToArray();
|
||||
}
|
||||
|
|
@ -105,6 +111,7 @@ public class BdInfoDirectoryInfo : IDirectoryInfo
|
|||
new[] { searchPattern },
|
||||
false,
|
||||
searchOption == SearchOption.AllDirectories)
|
||||
.Where(d => !IsHidden(d.Name))
|
||||
.Select(x => new BdInfoFileInfo(x))
|
||||
.ToArray();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue