From 6d7909c3116674e5993854ebca0cecd750b49d2d Mon Sep 17 00:00:00 2001 From: derrod Date: Sun, 18 Jun 2023 00:39:11 +0200 Subject: [PATCH] [core/models] Add uninstaller to game model --- legendary/core.py | 7 ++++++- legendary/models/game.py | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/legendary/core.py b/legendary/core.py index 77c2a86..13f32d2 100644 --- a/legendary/core.py +++ b/legendary/core.py @@ -1472,6 +1472,11 @@ class LegendaryCore: prereq = dict(ids=new_manifest.meta.prereq_ids, name=new_manifest.meta.prereq_name, path=new_manifest.meta.prereq_path, args=new_manifest.meta.prereq_args) + uninstaller = None + if new_manifest.meta.uninstall_action_path: + uninstaller = dict(path=new_manifest.meta.uninstall_action_path, + args=new_manifest.meta.uninstall_action_args) + offline = game.metadata.get('customAttributes', {}).get('CanRunOffline', {}).get('value', 'true') ot = game.metadata.get('customAttributes', {}).get('OwnershipToken', {}).get('value', 'false') @@ -1495,7 +1500,7 @@ class LegendaryCore: can_run_offline=offline == 'true', requires_ot=ot == 'true', is_dlc=base_game is not None, install_size=anlres.install_size, egl_guid=egl_guid, install_tags=file_install_tag, - platform=platform) + platform=platform, uninstaller=uninstaller) return dlm, anlres, igame diff --git a/legendary/models/game.py b/legendary/models/game.py index 4c527d5..0d615ce 100644 --- a/legendary/models/game.py +++ b/legendary/models/game.py @@ -149,6 +149,7 @@ class InstalledGame: needs_verification: bool = False platform: str = 'Windows' prereq_info: Optional[Dict] = None + uninstaller: Optional[Dict] = None requires_ot: bool = False save_path: Optional[str] = None @@ -165,6 +166,7 @@ class InstalledGame: tmp.executable = json.get('executable', '') tmp.launch_parameters = json.get('launch_parameters', '') tmp.prereq_info = json.get('prereq_info', None) + tmp.uninstaller = json.get('uninstaller', None) tmp.can_run_offline = json.get('can_run_offline', False) tmp.requires_ot = json.get('requires_ot', False)