Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add mapping GameIniFiles: iniFiles() to BasicGame #123

Merged
merged 1 commit into from
Oct 21, 2023
Merged
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
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
Loading