From 998d4c31d36cce51ebc153492dca6347c3748c54 Mon Sep 17 00:00:00 2001 From: nyne Date: Fri, 7 Feb 2025 17:32:51 +0800 Subject: [PATCH] Improve importing comic: If the archive has only one directory, set working dir as it. --- lib/utils/cbz.dart | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/utils/cbz.dart b/lib/utils/cbz.dart index 16eee6a..214c787 100644 --- a/lib/utils/cbz.dart +++ b/lib/utils/cbz.dart @@ -85,6 +85,10 @@ abstract class CBZ { if (cache.existsSync()) cache.deleteSync(recursive: true); cache.createSync(); await extractArchive(file, cache); + var f = cache.listSync(); + if (f.length == 1 && f.first is Directory) { + cache = f.first as Directory; + } var metaDataFile = File(FilePath.join(cache.path, 'metadata.json')); ComicMetaData? metaData; if (metaDataFile.existsSync()) {