mirror of
https://github.com/ciromattia/kcc
synced 2025-12-15 18:56:28 +00:00
flatten subfolders if over windows MAX_LENGTH=260 characters (#922)
This commit is contained in:
@@ -842,6 +842,11 @@ def chunk_directory(path):
|
|||||||
level = -1
|
level = -1
|
||||||
for root, _, files in os.walk(os.path.join(path, 'OEBPS', 'Images')):
|
for root, _, files in os.walk(os.path.join(path, 'OEBPS', 'Images')):
|
||||||
for f in files:
|
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):
|
if getImageFileName(f):
|
||||||
newLevel = os.path.join(root, f).replace(os.path.join(path, 'OEBPS', 'Images'), '').count(os.sep)
|
newLevel = os.path.join(root, f).replace(os.path.join(path, 'OEBPS', 'Images'), '').count(os.sep)
|
||||||
if level != -1 and level != newLevel:
|
if level != -1 and level != newLevel:
|
||||||
|
|||||||
Reference in New Issue
Block a user