Check if directorypath is null

This commit is contained in:
Glax 2025-05-17 22:38:12 +02:00
parent 4ddfe4a54c
commit 703e32a30e

View File

@ -52,9 +52,16 @@ public class DownloadSingleChapterJob : Job
return []; return [];
} }
string saveArchiveFilePath = Chapter.FullArchiveFilePath; string saveArchiveFilePath = Chapter.FullArchiveFilePath;
Log.Debug($"Chapter path: {saveArchiveFilePath}");
//Check if Publication Directory already exists //Check if Publication Directory already exists
string directoryPath = Path.GetDirectoryName(saveArchiveFilePath)!; string? directoryPath = Path.GetDirectoryName(saveArchiveFilePath);
if (directoryPath is null)
{
Log.Error($"Directory path could not be found: {saveArchiveFilePath}");
this.state = JobState.Failed;
return [];
}
if (!Directory.Exists(directoryPath)) if (!Directory.Exists(directoryPath))
{ {
Log.Info($"Creating publication Directory: {directoryPath}"); Log.Info($"Creating publication Directory: {directoryPath}");