From 2f6f04371631471840af84f9ac12eea0856d04f1 Mon Sep 17 00:00:00 2001 From: derrod Date: Fri, 8 Oct 2021 09:39:55 +0200 Subject: [PATCH] [cli] Do not import DLC if base game is not installed Fixes #351 --- legendary/cli.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/legendary/cli.py b/legendary/cli.py index afc2168..99bcf21 100644 --- a/legendary/cli.py +++ b/legendary/cli.py @@ -1064,6 +1064,19 @@ class LegendaryCLI: logger.fatal(f'Did not find game "{args.app_name}" on account.') exit(1) + if game.is_dlc: + release_info = game.metadata.get('mainGameItem', {}).get('releaseInfo') + if release_info: + main_game_appname = release_info[0]['appId'] + main_game_title = game.metadata['mainGameItem']['title'] + if not self.core.is_installed(main_game_appname): + logger.error(f'Import candidate is DLC but base game "{main_game_title}" ' + f'(App name: "{main_game_appname}") is not installed!') + exit(1) + else: + logger.fatal(f'Unable to get base game information for DLC, cannot continue.') + exit(1) + # get everything needed for import from core, then run additional checks. manifest, igame = self.core.import_game(game, args.app_path) exe_path = os.path.join(args.app_path, manifest.meta.launch_exe.lstrip('/'))