aboutsummaryrefslogtreecommitdiffstats
path: root/src/slskd/Shares/SoulseekFileFactory.cs
diff options
context:
space:
mode:
authorJP Dillingham <jp@dillingham.me>2024-07-08 15:26:36 -0500
committerJP Dillingham <jp@dillingham.me>2024-07-08 15:26:36 -0500
commitbc8efd12e033c4bc74b0d0a604396d1ff52210e1 (patch)
treeb7fc130c04092fb78bb0848a482bcd7bf1b64f5a /src/slskd/Shares/SoulseekFileFactory.cs
parent0b28c8fb0ce3ebe7d13bbcae5c4984475e1f7ab1 (diff)
downloadslskd-bc8efd12e033c4bc74b0d0a604396d1ff52210e1.tar.gz
use FileService to get FileInfo when scanning
Diffstat (limited to 'src/slskd/Shares/SoulseekFileFactory.cs')
-rw-r--r--src/slskd/Shares/SoulseekFileFactory.cs12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/slskd/Shares/SoulseekFileFactory.cs b/src/slskd/Shares/SoulseekFileFactory.cs
index fe3f92b1..b071dcf1 100644
--- a/src/slskd/Shares/SoulseekFileFactory.cs
+++ b/src/slskd/Shares/SoulseekFileFactory.cs
@@ -49,6 +49,16 @@ namespace slskd.Shares
private static readonly string[] VideoExtensions = { "mkv", "ogv", "avi", "wmv", "asf", "mp4", "m4p", "m4v", "mpg", "mpe", "mpv", "mpg", "m2v" };
private static readonly HashSet<string> SupportedExtensions = AudioExtensions.Concat(VideoExtensions).ToHashSet();
+ /// <summary>
+ /// Initializes a new instance of the <see cref="SoulseekFileFactory"/> class.
+ /// </summary>
+ /// <param name="fileService"></param>
+ public SoulseekFileFactory(FileService fileService)
+ {
+ Files = fileService;
+ }
+
+ private FileService Files { get; }
private ILogger Log { get; } = Serilog.Log.ForContext<SoulseekFileFactory>();
/// <summary>
@@ -60,7 +70,7 @@ namespace slskd.Shares
public File Create(string filename, string maskedFilename)
{
var code = 1;
- var size = new FileInfo(filename).FollowSymlink().Length;
+ var size = Files.ResolveFileInfo(filename).Length;
var extension = Path.GetExtension(filename).TrimStart('.').ToLowerInvariant();
List<FileAttribute> attributeList = default;