Skip to content

Commit fe55bbe

Browse files
committed
fix check for if directory is packable in baldursgate3.pak_parser
1 parent f14428a commit fe55bbe

1 file changed

Lines changed: 9 additions & 13 deletions

File tree

games/baldursgate3/pak_parser.py

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import configparser
22
import hashlib
3-
import itertools
43
import os
54
import re
65
import shutil
@@ -12,14 +11,13 @@
1211
from xml.etree import ElementTree
1312
from xml.etree.ElementTree import Element
1413

14+
import mobase
1515
from PyQt6.QtCore import (
1616
qDebug,
1717
qInfo,
1818
qWarning,
1919
)
2020

21-
import mobase
22-
2321
from . import bg3_utils
2422

2523

@@ -139,15 +137,14 @@ def _get_metadata_for_file(
139137
meta_file.unlink(missing_ok=True)
140138
if self._utils.extract_full_package:
141139
Path(str(meta_file)[:-4]).unlink(missing_ok=True)
142-
elif file.is_dir() and self._folder_pattern.search(file.name):
143-
# qDebug(f"directory is not packable: {file}")
144-
return ""
145-
elif next(
146-
itertools.chain(
147-
file.glob(f"{folder}/*") for folder in bg3_utils.loose_file_folders
148-
),
149-
False,
150-
):
140+
elif file.is_dir():
141+
if self._folder_pattern.search(file.name):
142+
return ""
143+
for folder in bg3_utils.loose_file_folders:
144+
if next(file.glob(f"{folder}/*"), False):
145+
break
146+
else:
147+
return ""
151148
qInfo(f"packable dir: {file}")
152149
if (file.parent / f"{file.name}.pak").exists() or (
153150
file.parent / "Mods" / f"{file.name}.pak"
@@ -187,7 +184,6 @@ def _get_metadata_for_file(
187184
lambda: meta_files[0],
188185
)
189186
else:
190-
# qDebug(f"non packable dir, unlikely to be used by the game: {file}")
191187
return ""
192188
except Exception:
193189
qWarning(traceback.format_exc())

0 commit comments

Comments
 (0)