Skip to content

Commit

Permalink
Fixed the issue where the images of multi-chapter comic are downloade…
Browse files Browse the repository at this point in the history
…d to invalid folder.
  • Loading branch information
wgh136 committed Dec 18, 2024
1 parent 929ec88 commit eb1abfc
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/network/download.dart
Original file line number Diff line number Diff line change
Expand Up @@ -146,14 +146,19 @@ class ImagesDownloadTask extends DownloadTask with _TransferSpeedMixin {

String? _cover;

/// All images to download, key is chapter name
Map<String, List<String>>? _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 = <int, _ImageDownloadWrapper>{};
Expand All @@ -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!);
Expand Down

0 comments on commit eb1abfc

Please sign in to comment.