mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-12-06 09:03:03 +03: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:
@@ -1,3 +1,4 @@
|
|||||||
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using BDInfo.IO;
|
using BDInfo.IO;
|
||||||
@@ -58,6 +59,8 @@ public class BdInfoDirectoryInfo : IDirectoryInfo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static bool IsHidden(ReadOnlySpan<char> name) => name.StartsWith('.');
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the directories.
|
/// Gets the directories.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -65,6 +68,7 @@ public class BdInfoDirectoryInfo : IDirectoryInfo
|
|||||||
public IDirectoryInfo[] GetDirectories()
|
public IDirectoryInfo[] GetDirectories()
|
||||||
{
|
{
|
||||||
return _fileSystem.GetDirectories(_impl.FullName)
|
return _fileSystem.GetDirectories(_impl.FullName)
|
||||||
|
.Where(d => !IsHidden(d.Name))
|
||||||
.Select(x => new BdInfoDirectoryInfo(_fileSystem, x))
|
.Select(x => new BdInfoDirectoryInfo(_fileSystem, x))
|
||||||
.ToArray();
|
.ToArray();
|
||||||
}
|
}
|
||||||
@@ -76,6 +80,7 @@ public class BdInfoDirectoryInfo : IDirectoryInfo
|
|||||||
public IFileInfo[] GetFiles()
|
public IFileInfo[] GetFiles()
|
||||||
{
|
{
|
||||||
return _fileSystem.GetFiles(_impl.FullName)
|
return _fileSystem.GetFiles(_impl.FullName)
|
||||||
|
.Where(d => !IsHidden(d.Name))
|
||||||
.Select(x => new BdInfoFileInfo(x))
|
.Select(x => new BdInfoFileInfo(x))
|
||||||
.ToArray();
|
.ToArray();
|
||||||
}
|
}
|
||||||
@@ -88,6 +93,7 @@ public class BdInfoDirectoryInfo : IDirectoryInfo
|
|||||||
public IFileInfo[] GetFiles(string searchPattern)
|
public IFileInfo[] GetFiles(string searchPattern)
|
||||||
{
|
{
|
||||||
return _fileSystem.GetFiles(_impl.FullName, new[] { searchPattern }, false, false)
|
return _fileSystem.GetFiles(_impl.FullName, new[] { searchPattern }, false, false)
|
||||||
|
.Where(d => !IsHidden(d.Name))
|
||||||
.Select(x => new BdInfoFileInfo(x))
|
.Select(x => new BdInfoFileInfo(x))
|
||||||
.ToArray();
|
.ToArray();
|
||||||
}
|
}
|
||||||
@@ -105,6 +111,7 @@ public class BdInfoDirectoryInfo : IDirectoryInfo
|
|||||||
new[] { searchPattern },
|
new[] { searchPattern },
|
||||||
false,
|
false,
|
||||||
searchOption == SearchOption.AllDirectories)
|
searchOption == SearchOption.AllDirectories)
|
||||||
|
.Where(d => !IsHidden(d.Name))
|
||||||
.Select(x => new BdInfoFileInfo(x))
|
.Select(x => new BdInfoFileInfo(x))
|
||||||
.ToArray();
|
.ToArray();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user