Skip to content

Commit

Permalink
Add mapping GameIniFiles: iniFiles() to BasicGame (#123)
Browse files Browse the repository at this point in the history
  • Loading branch information
ZashIn authored Oct 21, 2023
1 parent bcf7f0e commit fba4bd8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ class Witcher3Game(BasicGame):
| GameLauncher | Name of the game launcher, relative to the game path (Optional) | `getLauncherName` | `str` |
| GameDataPath | Name of the folder containing mods, relative to game folder| `dataDirectory` | |
| GameDocumentsDirectory | Documents directory (Optional) | `documentsDirectory` | `str` or `QDir` |
| GameIniFiles | Config files in documents, for profile specific config (Optional) | `iniFiles` | `str` or `List[str]` |
| GameSavesDirectory | Directory containing saves (Optional, default to `GameDocumentsDirectory`) | `savesDirectory` | `str` or `QDir` |
| GameSaveExtension | Save file extension (Optional) `savegameExtension` | `str` |
| GameSteamId | Steam ID of the game (Optional) | `steamAPPId` | `List[str]` or `str` or `int` |
Expand Down
13 changes: 13 additions & 0 deletions basic_game.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ class BasicGameMappings:
launcherName: BasicGameMapping[str]
dataDirectory: BasicGameMapping[str]
documentsDirectory: BasicGameMapping[QDir]
iniFiles: BasicGameMapping[list[str]]
savesDirectory: BasicGameMapping[QDir]
savegameExtension: BasicGameMapping[str]
steamAPPId: BasicGameOptionsMapping[str]
Expand Down Expand Up @@ -290,6 +291,15 @@ def __init__(self, game: BasicGame):
apply_fn=lambda s: QDir(s) if isinstance(s, str) else s,
default=BasicGameMappings._default_documents_directory,
)
self.iniFiles = BasicGameMapping(
game,
"GameIniFiles",
"iniFiles",
lambda g: [],
apply_fn=lambda value: [c.strip() for c in value.split(",")]
if isinstance(value, str)
else value,
)
self.savesDirectory = BasicGameMapping(
game,
"GameSavesDirectory",
Expand Down Expand Up @@ -543,6 +553,9 @@ def getLauncherName(self) -> str:
def getSupportURL(self) -> str:
return self._mappings.supportURL.get()

def iniFiles(self) -> list[str]:
return self._mappings.iniFiles.get()

def executables(self) -> list[mobase.ExecutableInfo]:
execs: list[mobase.ExecutableInfo] = []
if self.getLauncherName():
Expand Down

0 comments on commit fba4bd8

Please sign in to comment.