Skip to content

Commit abd1ea4

Browse files
committed
fix script extender mapped paths
1 parent 1fb361c commit abd1ea4

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

games/game_baldursgate3.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -252,19 +252,18 @@ def mappings(self) -> list[mobase.Mapping]:
252252

253253
def map_files(
254254
path: Path,
255+
dest: Path = docs_path,
255256
pattern: str = "*",
256257
rel: bool = True,
257258
):
258259
dest_func: Callable[[Path], str] = (
259-
(lambda f: os.path.relpath(f, path))
260-
if rel
261-
else lambda f: f"Mods/{f.name}"
260+
(lambda f: os.path.relpath(f, path)) if rel else lambda f: f.name
262261
)
263262
for file in list(path.rglob(pattern)):
264263
mappings.append(
265264
mobase.Mapping(
266265
source=str(file),
267-
destination=str(docs_path / dest_func(file)),
266+
destination=str(dest / dest_func(file)),
268267
is_directory=file.is_dir(),
269268
create_target=True,
270269
)
@@ -273,10 +272,12 @@ def map_files(
273272
progress = self._create_progress_window(
274273
"Mapping files to documents folder", len(active_mods) + 1
275274
)
275+
docs_path_mods = docs_path / "Mods"
276+
docs_path_se = docs_path / "Script Extender"
276277
for mod in active_mods:
277278
modpath = Path(mod.absolutePath())
278-
map_files(modpath, pattern="*.pak", rel=False)
279-
map_files(modpath / "Script Extender")
279+
map_files(modpath, docs_path_mods, pattern="*.pak", rel=False)
280+
map_files(modpath / "Script Extender", docs_path_se)
280281
progress.setValue(progress.value() + 1)
281282
QApplication.processEvents()
282283
map_files(self._overwrite_path)

0 commit comments

Comments
 (0)