From 581ecd0ec25debebf46732f37b369910a9e9ef04 Mon Sep 17 00:00:00 2001 From: Alex Xu Date: Thu, 22 May 2025 18:04:21 -0700 Subject: [PATCH] flatten subfolders if over windows MAX_LENGTH=260 characters (#922) --- kindlecomicconverter/comic2ebook.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/kindlecomicconverter/comic2ebook.py b/kindlecomicconverter/comic2ebook.py index 4b651b8..ce091b9 100755 --- a/kindlecomicconverter/comic2ebook.py +++ b/kindlecomicconverter/comic2ebook.py @@ -842,6 +842,11 @@ def chunk_directory(path): level = -1 for root, _, files in os.walk(os.path.join(path, 'OEBPS', 'Images')): for f in files: + # Windows MAX_LENGTH = 260 plus some buffer + if len(os.path.join(root, f)) > 180: + flattenTree(os.path.join(path, 'OEBPS', 'Images')) + level = 1 + break if getImageFileName(f): newLevel = os.path.join(root, f).replace(os.path.join(path, 'OEBPS', 'Images'), '').count(os.sep) if level != -1 and level != newLevel: