From 27d8565dc1bda332bbcef2feb9323c8a88375666 Mon Sep 17 00:00:00 2001 From: glax Date: Mon, 22 May 2023 17:09:47 +0200 Subject: [PATCH] fixes #14 --- Tranga/Connector.cs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/Tranga/Connector.cs b/Tranga/Connector.cs index 38d4e58..0a33260 100644 --- a/Tranga/Connector.cs +++ b/Tranga/Connector.cs @@ -106,7 +106,7 @@ public abstract class Connector /// Filepath protected string CreateFullFilepath(Publication publication, Chapter chapter) { - return Path.Join(downloadLocation, publication.folderName, chapter.fileName); + return Path.Join(downloadLocation, publication.folderName, $"{chapter.fileName}.cbz"); } /// @@ -134,13 +134,11 @@ public abstract class Connector { logger?.WriteLine("Connector", "Downloading Images"); //Check if Publication Directory already exists - string[] splitPath = saveArchiveFilePath.Split(Path.DirectorySeparatorChar); - string directoryPath = Path.Combine(splitPath.Take(splitPath.Length - 1).ToArray()); + string directoryPath = Path.GetDirectoryName(saveArchiveFilePath)!; if (!Directory.Exists(directoryPath)) Directory.CreateDirectory(directoryPath); - - string fullPath = $"{saveArchiveFilePath}.cbz"; - if (File.Exists(fullPath)) //Don't download twice. + + if (File.Exists(saveArchiveFilePath)) //Don't download twice. return; //Create a temporary folder to store images @@ -160,7 +158,7 @@ public abstract class Connector logger?.WriteLine("Connector", "Creating archive"); //ZIP-it and ship-it - ZipFile.CreateFromDirectory(tempFolder, fullPath); + ZipFile.CreateFromDirectory(tempFolder, saveArchiveFilePath); Directory.Delete(tempFolder, true); //Cleanup } -- 2.45.2