diff options
| author | Shadowghost <Ghost_of_Stone@web.de> | 2026-03-14 19:57:18 +0100 |
|---|---|---|
| committer | Shadowghost <Ghost_of_Stone@web.de> | 2026-03-14 19:57:18 +0100 |
| commit | 4b48cad6f79123c25bb3c15c006afd27f0b49e45 (patch) | |
| tree | aca7ff05b2ea48ebd37dd0ff79f3b966d96206f3 /MediaBrowser.Controller | |
| parent | 27d54c5b1c96a9b81daa772ad18207204e9ce00c (diff) | |
Don't throw if path is missing
Diffstat (limited to 'MediaBrowser.Controller')
| -rw-r--r-- | MediaBrowser.Controller/Providers/DirectoryService.cs | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/MediaBrowser.Controller/Providers/DirectoryService.cs b/MediaBrowser.Controller/Providers/DirectoryService.cs index a1edfa3c96..5b5af75a47 100644 --- a/MediaBrowser.Controller/Providers/DirectoryService.cs +++ b/MediaBrowser.Controller/Providers/DirectoryService.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Concurrent; using System.Collections.Generic; +using System.IO; using System.Linq; using MediaBrowser.Model.IO; @@ -26,7 +27,20 @@ namespace MediaBrowser.Controller.Providers public FileSystemMetadata[] GetFileSystemEntries(string path) { - return _cache.GetOrAdd(path, static (p, fileSystem) => fileSystem.GetFileSystemEntries(p).ToArray(), _fileSystem); + return _cache.GetOrAdd( + path, + static (p, fileSystem) => + { + try + { + return fileSystem.GetFileSystemEntries(p).ToArray(); + } + catch (DirectoryNotFoundException) + { + return []; + } + }, + _fileSystem); } public List<FileSystemMetadata> GetDirectories(string path) @@ -98,7 +112,20 @@ namespace MediaBrowser.Controller.Providers _filePathCache.TryRemove(path, out _); } - var filePaths = _filePathCache.GetOrAdd(path, static (p, fileSystem) => fileSystem.GetFilePaths(p).ToList(), _fileSystem); + var filePaths = _filePathCache.GetOrAdd( + path, + static (p, fileSystem) => + { + try + { + return fileSystem.GetFilePaths(p).ToList(); + } + catch (DirectoryNotFoundException) + { + return []; + } + }, + _fileSystem); if (sort) { |
