diff options
Diffstat (limited to 'Emby.Server.Implementations/IO/ManagedFileSystem.cs')
| -rw-r--r-- | Emby.Server.Implementations/IO/ManagedFileSystem.cs | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/Emby.Server.Implementations/IO/ManagedFileSystem.cs b/Emby.Server.Implementations/IO/ManagedFileSystem.cs index 7c44878ec..8ffb0f74a 100644 --- a/Emby.Server.Implementations/IO/ManagedFileSystem.cs +++ b/Emby.Server.Implementations/IO/ManagedFileSystem.cs @@ -4,8 +4,10 @@ using System.Diagnostics; using System.IO; using System.Linq; using System.Text; +using MediaBrowser.Common.Configuration; using MediaBrowser.Model.IO; using MediaBrowser.Model.System; +using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Logging; namespace Emby.Server.Implementations.IO @@ -20,30 +22,30 @@ namespace Emby.Server.Implementations.IO private readonly bool _supportsAsyncFileStreams; private char[] _invalidFileNameChars; private readonly List<IShortcutHandler> _shortcutHandlers = new List<IShortcutHandler>(); - private bool EnableSeparateFileAndDirectoryQueries; + private readonly bool EnableSeparateFileAndDirectoryQueries; - private string _tempPath; + private readonly string _tempPath; - private IEnvironmentInfo _environmentInfo; - private bool _isEnvironmentCaseInsensitive; + private readonly IEnvironmentInfo _environmentInfo; + private readonly bool _isEnvironmentCaseInsensitive; - private string _defaultDirectory; + private readonly string _defaultDirectory; public ManagedFileSystem( ILoggerFactory loggerFactory, IEnvironmentInfo environmentInfo, - string defaultDirectory, - string tempPath, - bool enableSeparateFileAndDirectoryQueries) + IApplicationPaths applicationPaths, + IConfiguration configuration) { Logger = loggerFactory.CreateLogger("FileSystem"); _supportsAsyncFileStreams = true; - _tempPath = tempPath; + _tempPath = applicationPaths.TempDirectory; _environmentInfo = environmentInfo; - _defaultDirectory = defaultDirectory; + _defaultDirectory = configuration["ManagedFileSystem:DefaultDirectory"]; // On Linux with mono, this needs to be true or symbolic links are ignored - EnableSeparateFileAndDirectoryQueries = enableSeparateFileAndDirectoryQueries; + EnableSeparateFileAndDirectoryQueries = + bool.Parse(configuration["ManagedFileSystem:EnableSeparateFileAndDirectoryQueries"]); SetInvalidFileNameChars(environmentInfo.OperatingSystem == MediaBrowser.Model.System.OperatingSystem.Windows); @@ -718,7 +720,7 @@ namespace Emby.Server.Implementations.IO SetAttributes(path, false, false); File.Delete(path); } - + public virtual List<FileSystemMetadata> GetDrives() { // Only include drives in the ready state or this method could end up being very slow, waiting for drives to timeout @@ -790,7 +792,7 @@ namespace Emby.Server.Implementations.IO { return infos.Select(GetFileSystemMetadata); } - + public virtual IEnumerable<string> GetDirectoryPaths(string path, bool recursive = false) { var searchOption = recursive ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly; |
