diff options
| author | Luke <luke.pulverenti@gmail.com> | 2015-09-13 17:32:02 -0400 |
|---|---|---|
| committer | Luke <luke.pulverenti@gmail.com> | 2015-09-13 17:32:02 -0400 |
| commit | 14de062681026157c6917779a51af6fb7046cec2 (patch) | |
| tree | fe72ade31e1ef3874e0ed71684fe8ed819e43cc0 /MediaBrowser.Controller/Providers/DirectoryService.cs | |
| parent | 0f743205c4835d828de9f28f6ab7d325209e83b2 (diff) | |
update file system methods
Diffstat (limited to 'MediaBrowser.Controller/Providers/DirectoryService.cs')
| -rw-r--r-- | MediaBrowser.Controller/Providers/DirectoryService.cs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/MediaBrowser.Controller/Providers/DirectoryService.cs b/MediaBrowser.Controller/Providers/DirectoryService.cs index 79ffb0d01..d320409f4 100644 --- a/MediaBrowser.Controller/Providers/DirectoryService.cs +++ b/MediaBrowser.Controller/Providers/DirectoryService.cs @@ -4,23 +4,26 @@ using System.Collections.Concurrent; using System.Collections.Generic; using System.IO; using System.Linq; +using MediaBrowser.Common.IO; namespace MediaBrowser.Controller.Providers { public class DirectoryService : IDirectoryService { private readonly ILogger _logger; + private readonly IFileSystem _fileSystem; private readonly ConcurrentDictionary<string, Dictionary<string,FileSystemInfo>> _cache = new ConcurrentDictionary<string, Dictionary<string, FileSystemInfo>>(StringComparer.OrdinalIgnoreCase); - public DirectoryService(ILogger logger) + public DirectoryService(ILogger logger, IFileSystem fileSystem) { _logger = logger; + _fileSystem = fileSystem; } - public DirectoryService() - : this(new NullLogger()) + public DirectoryService(IFileSystem fileSystem) + : this(new NullLogger(), fileSystem) { } @@ -59,8 +62,7 @@ namespace MediaBrowser.Controller.Providers try { // using EnumerateFileSystemInfos doesn't handle reparse points (symlinks) - var list = new DirectoryInfo(path).EnumerateDirectories("*", SearchOption.TopDirectoryOnly) - .Concat<FileSystemInfo>(new DirectoryInfo(path).EnumerateFiles("*", SearchOption.TopDirectoryOnly)); + var list = _fileSystem.GetFileSystemEntries(path); // Seeing dupes on some users file system for some reason foreach (var item in list) |
