Skip to content

Commit

Permalink
Fix Subnautica installer error
Browse files Browse the repository at this point in the history
  • Loading branch information
ZashIn committed Aug 12, 2024
1 parent e88d2d2 commit ab5fd23
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions games/game_subnautica.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ def __init__(self, patterns: GlobPatterns | None = None, use_qmods: bool = False
def dataLooksValid(
self, filetree: mobase.IFileTree
) -> mobase.ModDataChecker.CheckReturn:
# fix: single root folders get traversed by Simple Installer
parent = filetree.parent()
if parent is not None and self.dataLooksValid(parent) is self.FIXABLE:
return self.FIXABLE
check_return = super().dataLooksValid(filetree)
# A single unknown folder with a dll file in is to be moved to BepInEx/plugins/
if (
Expand All @@ -61,17 +65,21 @@ def dataLooksValid(
and is_directory(folder := filetree[0])
and any(fnmatch.fnmatch(entry.name(), "*.dll") for entry in folder)
):
qWarning("fixable")
return self.FIXABLE
qWarning(f"{check_return=}")
return check_return

def fix(self, filetree: mobase.IFileTree) -> mobase.IFileTree:
filetree = super().fix(filetree)
qWarning(f"{filetree=}")
if (
self.dataLooksValid(filetree) is self.FIXABLE
and len(filetree) == 1
and is_directory(folder := filetree[0])
and any(fnmatch.fnmatch(entry.name(), "*.dll") for entry in folder)
):
qWarning("move")
filetree.move(folder, "QMods/" if self.use_qmods else "BepInEx/plugins/")
return filetree

Expand Down

0 comments on commit ab5fd23

Please sign in to comment.