Skip to content

Commit 6d7909c

Browse files
committed
[core/models] Add uninstaller to game model
1 parent 0e35b70 commit 6d7909c

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

legendary/core.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1472,6 +1472,11 @@ def prepare_download(self, game: Game, base_game: Game = None, base_path: str =
14721472
prereq = dict(ids=new_manifest.meta.prereq_ids, name=new_manifest.meta.prereq_name,
14731473
path=new_manifest.meta.prereq_path, args=new_manifest.meta.prereq_args)
14741474

1475+
uninstaller = None
1476+
if new_manifest.meta.uninstall_action_path:
1477+
uninstaller = dict(path=new_manifest.meta.uninstall_action_path,
1478+
args=new_manifest.meta.uninstall_action_args)
1479+
14751480
offline = game.metadata.get('customAttributes', {}).get('CanRunOffline', {}).get('value', 'true')
14761481
ot = game.metadata.get('customAttributes', {}).get('OwnershipToken', {}).get('value', 'false')
14771482

@@ -1495,7 +1500,7 @@ def prepare_download(self, game: Game, base_game: Game = None, base_path: str =
14951500
can_run_offline=offline == 'true', requires_ot=ot == 'true',
14961501
is_dlc=base_game is not None, install_size=anlres.install_size,
14971502
egl_guid=egl_guid, install_tags=file_install_tag,
1498-
platform=platform)
1503+
platform=platform, uninstaller=uninstaller)
14991504

15001505
return dlm, anlres, igame
15011506

legendary/models/game.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ class InstalledGame:
149149
needs_verification: bool = False
150150
platform: str = 'Windows'
151151
prereq_info: Optional[Dict] = None
152+
uninstaller: Optional[Dict] = None
152153
requires_ot: bool = False
153154
save_path: Optional[str] = None
154155

@@ -165,6 +166,7 @@ def from_json(cls, json):
165166
tmp.executable = json.get('executable', '')
166167
tmp.launch_parameters = json.get('launch_parameters', '')
167168
tmp.prereq_info = json.get('prereq_info', None)
169+
tmp.uninstaller = json.get('uninstaller', None)
168170

169171
tmp.can_run_offline = json.get('can_run_offline', False)
170172
tmp.requires_ot = json.get('requires_ot', False)

0 commit comments

Comments
 (0)