aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/ScheduledTasks/ChapterImagesTask.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Emby.Server.Implementations/ScheduledTasks/ChapterImagesTask.cs')
-rw-r--r--Emby.Server.Implementations/ScheduledTasks/ChapterImagesTask.cs28
1 files changed, 16 insertions, 12 deletions
diff --git a/Emby.Server.Implementations/ScheduledTasks/ChapterImagesTask.cs b/Emby.Server.Implementations/ScheduledTasks/ChapterImagesTask.cs
index 0ae7ae96c..5373b4392 100644
--- a/Emby.Server.Implementations/ScheduledTasks/ChapterImagesTask.cs
+++ b/Emby.Server.Implementations/ScheduledTasks/ChapterImagesTask.cs
@@ -101,17 +101,20 @@ namespace Emby.Server.Implementations.ScheduledTasks
List<string> previouslyFailedImages;
- try
+ if (File.Exists(failHistoryPath))
{
- previouslyFailedImages = _fileSystem.ReadAllText(failHistoryPath)
- .Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries)
- .ToList();
- }
- catch (FileNotFoundException)
- {
- previouslyFailedImages = new List<string>();
+ try
+ {
+ previouslyFailedImages = File.ReadAllText(failHistoryPath)
+ .Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries)
+ .ToList();
+ }
+ catch (IOException)
+ {
+ previouslyFailedImages = new List<string>();
+ }
}
- catch (IOException)
+ else
{
previouslyFailedImages = new List<string>();
}
@@ -136,11 +139,12 @@ namespace Emby.Server.Implementations.ScheduledTasks
{
previouslyFailedImages.Add(key);
- var parentPath = _fileSystem.GetDirectoryName(failHistoryPath);
+ var parentPath = Path.GetDirectoryName(failHistoryPath);
- _fileSystem.CreateDirectory(parentPath);
+ Directory.CreateDirectory(parentPath);
- _fileSystem.WriteAllText(failHistoryPath, string.Join("|", previouslyFailedImages.ToArray()));
+ string text = string.Join("|", previouslyFailedImages);
+ File.WriteAllText(failHistoryPath, text);
}
numComplete++;