diff --git a/Emby.Server.Implementations/IO/ManagedFileSystem.cs b/Emby.Server.Implementations/IO/ManagedFileSystem.cs
index ee6846ad3..399ece7fd 100644
--- a/Emby.Server.Implementations/IO/ManagedFileSystem.cs
+++ b/Emby.Server.Implementations/IO/ManagedFileSystem.cs
@@ -705,9 +705,15 @@ namespace Emby.Server.Implementations.IO
}
///
- public virtual bool Exists(string path)
+ public virtual bool DirectoryExists(string path)
{
- return Directory.Exists(path) || File.Exists(path);
+ return Directory.Exists(path);
+ }
+
+ ///
+ public virtual bool FileExists(string path)
+ {
+ return File.Exists(path);
}
private EnumerationOptions GetEnumerationOptions(bool recursive)
diff --git a/MediaBrowser.Model/IO/IFileSystem.cs b/MediaBrowser.Model/IO/IFileSystem.cs
index 234d96369..786b20e9e 100644
--- a/MediaBrowser.Model/IO/IFileSystem.cs
+++ b/MediaBrowser.Model/IO/IFileSystem.cs
@@ -202,10 +202,17 @@ namespace MediaBrowser.Model.IO
IEnumerable GetDrives();
///
- /// Determines whether the directory or file exists.
+ /// Determines whether the directory exists.
///
/// The path.
/// Whether the path exists.
- bool Exists(string path);
+ bool DirectoryExists(string path);
+
+ ///
+ /// Determines whether the file exists.
+ ///
+ /// The path.
+ /// Whether the path exists.
+ bool FileExists(string path);
}
}
diff --git a/MediaBrowser.Providers/MediaInfo/MediaInfoResolver.cs b/MediaBrowser.Providers/MediaInfo/MediaInfoResolver.cs
index dc3576eab..359eb8802 100644
--- a/MediaBrowser.Providers/MediaInfo/MediaInfoResolver.cs
+++ b/MediaBrowser.Providers/MediaInfo/MediaInfoResolver.cs
@@ -154,7 +154,7 @@ namespace MediaBrowser.Providers.MediaInfo
// Check if video folder exists
string folder = video.ContainingFolderPath;
- if (!_fileSystem.Exists(folder))
+ if (!_fileSystem.DirectoryExists(folder))
{
return Array.Empty();
}
@@ -163,7 +163,7 @@ namespace MediaBrowser.Providers.MediaInfo
var files = directoryService.GetFilePaths(folder, clearCache).ToList();
var internalMetadataPath = video.GetInternalMetadataPath();
- if (_fileSystem.Exists(internalMetadataPath))
+ if (_fileSystem.DirectoryExists(internalMetadataPath))
{
files.AddRange(directoryService.GetFilePaths(internalMetadataPath, clearCache));
}
diff --git a/tests/Jellyfin.Providers.Tests/MediaInfo/AudioResolverTests.cs b/tests/Jellyfin.Providers.Tests/MediaInfo/AudioResolverTests.cs
index 9df0c7a06..aec523882 100644
--- a/tests/Jellyfin.Providers.Tests/MediaInfo/AudioResolverTests.cs
+++ b/tests/Jellyfin.Providers.Tests/MediaInfo/AudioResolverTests.cs
@@ -47,9 +47,9 @@ public class AudioResolverTests
}));
var fileSystem = new Mock(MockBehavior.Strict);
- fileSystem.Setup(fs => fs.Exists(It.IsRegex(MediaInfoResolverTests.VideoDirectoryRegex)))
+ fileSystem.Setup(fs => fs.DirectoryExists(It.IsRegex(MediaInfoResolverTests.VideoDirectoryRegex)))
.Returns(true);
- fileSystem.Setup(fs => fs.Exists(It.IsRegex(MediaInfoResolverTests.MetadataDirectoryRegex)))
+ fileSystem.Setup(fs => fs.DirectoryExists(It.IsRegex(MediaInfoResolverTests.MetadataDirectoryRegex)))
.Returns(true);
_audioResolver = new AudioResolver(localizationManager, mediaEncoder.Object, fileSystem.Object, new NamingOptions());
diff --git a/tests/Jellyfin.Providers.Tests/MediaInfo/MediaInfoResolverTests.cs b/tests/Jellyfin.Providers.Tests/MediaInfo/MediaInfoResolverTests.cs
index 94a4961b5..89bc416de 100644
--- a/tests/Jellyfin.Providers.Tests/MediaInfo/MediaInfoResolverTests.cs
+++ b/tests/Jellyfin.Providers.Tests/MediaInfo/MediaInfoResolverTests.cs
@@ -63,11 +63,11 @@ public class MediaInfoResolverTests
}));
var fileSystem = new Mock(MockBehavior.Strict);
- fileSystem.Setup(fs => fs.Exists(It.IsAny()))
+ fileSystem.Setup(fs => fs.DirectoryExists(It.IsAny()))
.Returns(false);
- fileSystem.Setup(fs => fs.Exists(It.IsRegex(VideoDirectoryRegex)))
+ fileSystem.Setup(fs => fs.DirectoryExists(It.IsRegex(VideoDirectoryRegex)))
.Returns(true);
- fileSystem.Setup(fs => fs.Exists(It.IsRegex(MetadataDirectoryRegex)))
+ fileSystem.Setup(fs => fs.DirectoryExists(It.IsRegex(MetadataDirectoryRegex)))
.Returns(true);
_subtitleResolver = new SubtitleResolver(_localizationManager, mediaEncoder.Object, fileSystem.Object, new NamingOptions());
@@ -300,9 +300,9 @@ public class MediaInfoResolverTests
}));
var fileSystem = new Mock(MockBehavior.Strict);
- fileSystem.Setup(fs => fs.Exists(It.IsRegex(VideoDirectoryRegex)))
+ fileSystem.Setup(fs => fs.DirectoryExists(It.IsRegex(VideoDirectoryRegex)))
.Returns(true);
- fileSystem.Setup(fs => fs.Exists(It.IsRegex(MetadataDirectoryRegex)))
+ fileSystem.Setup(fs => fs.DirectoryExists(It.IsRegex(MetadataDirectoryRegex)))
.Returns(true);
var subtitleResolver = new SubtitleResolver(_localizationManager, mediaEncoder.Object, fileSystem.Object, new NamingOptions());
@@ -372,9 +372,9 @@ public class MediaInfoResolverTests
}));
var fileSystem = new Mock(MockBehavior.Strict);
- fileSystem.Setup(fs => fs.Exists(It.IsRegex(VideoDirectoryRegex)))
+ fileSystem.Setup(fs => fs.DirectoryExists(It.IsRegex(VideoDirectoryRegex)))
.Returns(true);
- fileSystem.Setup(fs => fs.Exists(It.IsRegex(MetadataDirectoryRegex)))
+ fileSystem.Setup(fs => fs.DirectoryExists(It.IsRegex(MetadataDirectoryRegex)))
.Returns(true);
var subtitleResolver = new SubtitleResolver(_localizationManager, mediaEncoder.Object, fileSystem.Object, new NamingOptions());
diff --git a/tests/Jellyfin.Providers.Tests/MediaInfo/SubtitleResolverTests.cs b/tests/Jellyfin.Providers.Tests/MediaInfo/SubtitleResolverTests.cs
index 3ba9d8fbf..0e6457ce3 100644
--- a/tests/Jellyfin.Providers.Tests/MediaInfo/SubtitleResolverTests.cs
+++ b/tests/Jellyfin.Providers.Tests/MediaInfo/SubtitleResolverTests.cs
@@ -47,9 +47,9 @@ public class SubtitleResolverTests
}));
var fileSystem = new Mock(MockBehavior.Strict);
- fileSystem.Setup(fs => fs.Exists(It.IsRegex(MediaInfoResolverTests.VideoDirectoryRegex)))
+ fileSystem.Setup(fs => fs.DirectoryExists(It.IsRegex(MediaInfoResolverTests.VideoDirectoryRegex)))
.Returns(true);
- fileSystem.Setup(fs => fs.Exists(It.IsRegex(MediaInfoResolverTests.MetadataDirectoryRegex)))
+ fileSystem.Setup(fs => fs.DirectoryExists(It.IsRegex(MediaInfoResolverTests.MetadataDirectoryRegex)))
.Returns(true);
_subtitleResolver = new SubtitleResolver(localizationManager, mediaEncoder.Object, fileSystem.Object, new NamingOptions());