Skip to content

Commit 3586bcd

Browse files
[Baldur's Gate 3]: Fix ValueError due to assumption that MO2 is installed in home directory
1 parent 4a9fb70 commit 3586bcd

1 file changed

Lines changed: 4 additions & 10 deletions

File tree

games/game_baldursgate3.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -190,9 +190,7 @@ def _on_finished_run(self, exec_path: str, exit_code: int):
190190
moved: dict[str, str] = {}
191191
for path in self.utils.overwrite_path.rglob("*.log"):
192192
try:
193-
moved[str(path.relative_to(Path.home()))] = str(
194-
(self.utils.log_dir / path.name).relative_to(Path.home())
195-
)
193+
moved[str(path)] = str((self.utils.log_dir / path.name))
196194
path.replace(self.utils.log_dir / path.name)
197195
except PermissionError as e:
198196
qDebug(str(e))
@@ -201,9 +199,7 @@ def _on_finished_run(self, exec_path: str, exit_code: int):
201199
if path.name == "log.txt":
202200
dest = self.utils.log_dir / f"{path.parent.name}-{path.name}"
203201
try:
204-
moved[str(path.relative_to(Path.home()))] = str(
205-
dest.relative_to(Path.home())
206-
)
202+
moved[str(path)] = str(dest)
207203
path.replace(dest)
208204
except PermissionError as e:
209205
qDebug(str(e))
@@ -230,10 +226,8 @@ def _on_finished_run(self, exec_path: str, exit_code: int):
230226
for folder in sorted(list(fdir.walk(top_down=False)))[:-1]:
231227
try:
232228
folder[0].rmdir()
233-
removed.add(folder[0].relative_to(Path.home()))
229+
removed.add(folder[0])
234230
except OSError:
235231
pass
236232
if cat is not None and cat.isDebugEnabled() and len(removed) > 0:
237-
qDebug(
238-
f"cleaned empty dirs from {fdir.relative_to(Path.home())} {removed}"
239-
)
233+
qDebug(f"cleaned empty dirs from {fdir} {removed}")

0 commit comments

Comments
 (0)