Check for existence before trying to delete directory
This commit is contained in:
parent
b63f7a2bc0
commit
8b442a7749
|
@ -194,7 +194,7 @@ namespace MediaBrowser.Providers.Manager
|
||||||
if (item is Episode && directory.Equals("metadata", StringComparison.Ordinal))
|
if (item is Episode && directory.Equals("metadata", StringComparison.Ordinal))
|
||||||
{
|
{
|
||||||
var parentDirectoryPath = Directory.GetParent(currentPath).FullName;
|
var parentDirectoryPath = Directory.GetParent(currentPath).FullName;
|
||||||
if (!_fileSystem.GetFiles(parentDirectoryPath).Any())
|
if (_fileSystem.DirectoryExists(parentDirectoryPath) && !_fileSystem.GetFiles(parentDirectoryPath).Any())
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
|
@ -384,7 +384,7 @@ namespace MediaBrowser.Providers.Manager
|
||||||
{
|
{
|
||||||
var oldLocalMetadataDirectory = Path.Combine(item.ContainingFolderPath, "metadata");
|
var oldLocalMetadataDirectory = Path.Combine(item.ContainingFolderPath, "metadata");
|
||||||
var localImages = images.Where(i => i.Path.StartsWith(oldLocalMetadataDirectory, StringComparison.Ordinal)).ToList();
|
var localImages = images.Where(i => i.Path.StartsWith(oldLocalMetadataDirectory, StringComparison.Ordinal)).ToList();
|
||||||
if (!_fileSystem.GetFiles(oldLocalMetadataDirectory).Any())
|
if (_fileSystem.DirectoryExists(oldLocalMetadataDirectory) && !_fileSystem.GetFiles(oldLocalMetadataDirectory).Any())
|
||||||
{
|
{
|
||||||
Directory.Delete(oldLocalMetadataDirectory);
|
Directory.Delete(oldLocalMetadataDirectory);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user