11from __future__ import annotations
22
3- import fnmatch
43from pathlib import Path
54
65from PyQt6 .QtCore import QDir
98
109from ..basic_features import BasicModDataChecker , GlobPatterns
1110from ..basic_features .basic_save_game_info import BasicGameSaveGame
12- from ..basic_features .utils import is_directory
1311from ..basic_game import BasicGame
1412
1513
@@ -20,14 +18,14 @@ def __init__(self, patterns: GlobPatterns | None = None):
2018 valid = [
2119 # BepInEx files go to root
2220 "BepInEx" ,
23- "doorstop_config.ini" ,
21+ "doorstop_config.ini" ,
2422 "winhttp.dll" ,
2523 ".doorstop_version" ,
2624 ],
2725 delete = [
2826 "*.txt" ,
2927 "*.md" ,
30- "manifest.json" ,
28+ "manifest.json" ,
3129 "icon.png" ,
3230 ],
3331 ).merge (patterns or GlobPatterns ()),
@@ -39,29 +37,34 @@ def dataLooksValid(
3937 # Check if it contains BepInEx folders/files - if so, keep structure
4038 if self ._has_bepinex_structure (filetree ):
4139 return self .VALID
42-
40+
4341 # Everything else needs to go to BepInEx/plugins/
4442 return self .FIXABLE
4543
4644 def _has_bepinex_structure (self , filetree : mobase .IFileTree ) -> bool :
4745 """Check if the mod has BepInEx folder structure"""
4846 for entry in filetree :
4947 name = entry .name ().lower ()
50- if name in ["bepinex" , "doorstop_config.ini" , "winhttp.dll" , ".doorstop_version" ]:
48+ if name in [
49+ "bepinex" ,
50+ "doorstop_config.ini" ,
51+ "winhttp.dll" ,
52+ ".doorstop_version" ,
53+ ]:
5154 return True
5255 return False
5356
5457 def fix (self , filetree : mobase .IFileTree ) -> mobase .IFileTree :
5558 # First apply the basic fix (handles delete patterns)
5659 filetree = super ().fix (filetree )
57-
60+
5861 # If no BepInEx structure, move everything to BepInEx/plugins/
5962 if not self ._has_bepinex_structure (filetree ):
6063 # Move all top-level items to BepInEx/plugins/
6164 items_to_move = list (filetree )
6265 for item in items_to_move :
6366 filetree .move (item , f"BepInEx/plugins/{ item .name ()} " )
64-
67+
6568 return filetree
6669
6770
@@ -70,13 +73,15 @@ class SilksongGame(BasicGame):
7073 Author = "Assistant"
7174 Version = "1.0.0"
7275
73- GameName = "Hollow Knight: Silksong"
76+ GameName = "Hollow Knight: Silksong"
7477 GameShortName = "hollowknightsilksong" # Match the error message
7578 GameNexusName = "hollowknightsilksong"
7679 GameSteamId = 1030300
7780 GameBinary = r"Hollow Knight Silksong.exe"
7881 GameDataPath = ""
79- GameSavesDirectory = r"%USERPROFILE%\AppData\LocalLow\Team Cherry\Hollow Knight Silksong"
82+ GameSavesDirectory = (
83+ r"%USERPROFILE%\AppData\LocalLow\Team Cherry\Hollow Knight Silksong"
84+ )
8085 GameSupportURL = (
8186 r"https://github.com/ModOrganizer2/modorganizer-basic_games/wiki/"
8287 "Game:-Hollow-Knight-Silksong"
@@ -92,13 +97,13 @@ def init(self, organizer: mobase.IOrganizer) -> bool:
9297 def listSaves (self , folder : QDir ) -> list [mobase .ISaveGame ]:
9398 saves : list [mobase .ISaveGame ] = []
9499 save_dir = Path (folder .absolutePath ())
95-
100+
96101 if save_dir .exists ():
97102 # Look for common save file patterns
98103 for pattern in ["*.save" , "user*.dat" ]:
99104 for save_file in save_dir .rglob (pattern ):
100105 saves .append (BasicGameSaveGame (save_file ))
101-
106+
102107 return saves
103108
104109 def executables (self ) -> list [mobase .ExecutableInfo ]:
0 commit comments