Check if directory exists before creating

This commit is contained in:
glax 2023-05-19 22:58:59 +02:00
parent 1b59475254
commit 26ef59ab42
2 changed files with 5 additions and 2 deletions

View File

@ -59,7 +59,9 @@ public abstract class Connector
{
//Check if Publication already has a Folder and a series.json
string publicationFolder = Path.Join(downloadLocation, publication.folderName);
Directory.CreateDirectory(publicationFolder);
if(!Directory.Exists(publicationFolder))
Directory.CreateDirectory(publicationFolder);
string seriesInfoPath = Path.Join(publicationFolder, "series.json");
if(!File.Exists(seriesInfoPath))
File.WriteAllText(seriesInfoPath,publication.GetSeriesInfo());

View File

@ -205,7 +205,8 @@ public class MangaDex : Connector
{
//Check if Publication already has a Folder and cover
string publicationFolder = Path.Join(downloadLocation, publication.folderName);
Directory.CreateDirectory(publicationFolder);
if(!Directory.Exists(publicationFolder))
Directory.CreateDirectory(publicationFolder);
DirectoryInfo dirInfo = new (publicationFolder);
foreach(FileInfo fileInfo in dirInfo.EnumerateFiles())
if (fileInfo.Name.Contains("cover."))