Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion games/baldursgate3/bg3_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,8 @@ def retrieve_mod_metadata_in_new_thread(mod: mobase.IModInterface):
if mod.name() in metadata
)
+ self._mod_settings_xml_end
)
),
encoding="utf-8",
)
qInfo(
f"backing up generated file {self.modsettings_path} to {self.modsettings_backup}, "
Expand Down
19 changes: 13 additions & 6 deletions games/game_baldursgate3.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,13 @@ def _base_dlls(self) -> set[str]:
base_bin = Path(self.gameDirectory().absoluteFilePath("bin"))
return {str(f.relative_to(base_bin)) for f in base_bin.glob("*.dll")}

@staticmethod
def _format_debug_path(path: Path) -> Path:
try:
return path.relative_to(Path.home())
except ValueError:
return path

def _on_finished_run(self, exec_path: str, exit_code: int):
if "bin/bg3" not in exec_path:
return
Expand All @@ -190,8 +197,8 @@ def _on_finished_run(self, exec_path: str, exit_code: int):
moved: dict[str, str] = {}
for path in self.utils.overwrite_path.rglob("*.log"):
try:
moved[str(path.relative_to(Path.home()))] = str(
(self.utils.log_dir / path.name).relative_to(Path.home())
moved[str(self._format_debug_path(path))] = str(
self._format_debug_path(self.utils.log_dir / path.name)
)
path.replace(self.utils.log_dir / path.name)
except PermissionError as e:
Expand All @@ -201,8 +208,8 @@ def _on_finished_run(self, exec_path: str, exit_code: int):
if path.name == "log.txt":
dest = self.utils.log_dir / f"{path.parent.name}-{path.name}"
try:
moved[str(path.relative_to(Path.home()))] = str(
dest.relative_to(Path.home())
moved[str(self._format_debug_path(path))] = str(
self._format_debug_path(dest)
)
path.replace(dest)
except PermissionError as e:
Expand Down Expand Up @@ -230,10 +237,10 @@ def _on_finished_run(self, exec_path: str, exit_code: int):
for folder in sorted(list(fdir.walk(top_down=False)))[:-1]:
try:
folder[0].rmdir()
removed.add(folder[0].relative_to(Path.home()))
removed.add(self._format_debug_path(folder[0]))
except OSError:
pass
if cat is not None and cat.isDebugEnabled() and len(removed) > 0:
qDebug(
f"cleaned empty dirs from {fdir.relative_to(Path.home())} {removed}"
f"cleaned empty dirs from {self._format_debug_path(fdir)} {removed}"
)
Loading