aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/IO
diff options
context:
space:
mode:
authorPatrick Barron <barronpm@gmail.com>2023-10-03 10:25:14 -0400
committerPatrick Barron <barronpm@gmail.com>2023-10-03 10:25:14 -0400
commit78e00578c20d0127b540bc69290972104f12ac84 (patch)
tree9e830b47254252fbe196f2131cf0ffbdd16a3ed0 /Emby.Server.Implementations/IO
parentfa26bcde3a7b6c288ae5a528a45f08e64a6a2011 (diff)
Use DI for IFileSystem
Diffstat (limited to 'Emby.Server.Implementations/IO')
-rw-r--r--Emby.Server.Implementations/IO/ManagedFileSystem.cs19
1 files changed, 8 insertions, 11 deletions
diff --git a/Emby.Server.Implementations/IO/ManagedFileSystem.cs b/Emby.Server.Implementations/IO/ManagedFileSystem.cs
index 3aa5233ed..18b00ce0b 100644
--- a/Emby.Server.Implementations/IO/ManagedFileSystem.cs
+++ b/Emby.Server.Implementations/IO/ManagedFileSystem.cs
@@ -15,10 +15,6 @@ namespace Emby.Server.Implementations.IO
/// </summary>
public class ManagedFileSystem : IFileSystem
{
- private readonly ILogger<ManagedFileSystem> _logger;
-
- private readonly List<IShortcutHandler> _shortcutHandlers = new List<IShortcutHandler>();
- private readonly string _tempPath;
private static readonly bool _isEnvironmentCaseInsensitive = OperatingSystem.IsWindows();
private static readonly char[] _invalidPathCharacters =
{
@@ -29,23 +25,24 @@ namespace Emby.Server.Implementations.IO
(char)31, ':', '*', '?', '\\', '/'
};
+ private readonly ILogger<ManagedFileSystem> _logger;
+ private readonly List<IShortcutHandler> _shortcutHandlers;
+ private readonly string _tempPath;
+
/// <summary>
/// Initializes a new instance of the <see cref="ManagedFileSystem"/> class.
/// </summary>
/// <param name="logger">The <see cref="ILogger"/> instance to use.</param>
/// <param name="applicationPaths">The <see cref="IApplicationPaths"/> instance to use.</param>
+ /// <param name="shortcutHandlers">the <see cref="IShortcutHandler"/>'s to use.</param>
public ManagedFileSystem(
ILogger<ManagedFileSystem> logger,
- IApplicationPaths applicationPaths)
+ IApplicationPaths applicationPaths,
+ IEnumerable<IShortcutHandler> shortcutHandlers)
{
_logger = logger;
_tempPath = applicationPaths.TempDirectory;
- }
-
- /// <inheritdoc />
- public virtual void AddShortcutHandler(IShortcutHandler handler)
- {
- _shortcutHandlers.Add(handler);
+ _shortcutHandlers = shortcutHandlers.ToList();
}
/// <summary>