From eb1abfc02ac84546b67a738c86b338a1e4a18978 Mon Sep 17 00:00:00 2001 From: nyne Date: Wed, 18 Dec 2024 19:13:35 +0800 Subject: [PATCH] Fixed the issue where the images of multi-chapter comic are downloaded to invalid folder. --- lib/network/download.dart | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/network/download.dart b/lib/network/download.dart index 7657549..cb659d3 100644 --- a/lib/network/download.dart +++ b/lib/network/download.dart @@ -146,14 +146,19 @@ class ImagesDownloadTask extends DownloadTask with _TransferSpeedMixin { String? _cover; + /// All images to download, key is chapter name Map>? _images; + /// Downloaded image count int _downloadedCount = 0; + /// Total image count int _totalCount = 0; + /// Current downloading image index int _index = 0; + /// Current downloading chapter, index of [_images] int _chapter = 0; var tasks = {}; @@ -180,10 +185,10 @@ class ImagesDownloadTask extends DownloadTask with _TransferSpeedMixin { if (comic!.chapters != null) { saveTo = Directory(FilePath.join( path!, - comic!.chapters!.keys.elementAt(_chapter), + _images!.keys.elementAt(_chapter), )); if (!saveTo.existsSync()) { - saveTo.createSync(); + saveTo.createSync(recursive: true); } } else { saveTo = Directory(path!);