From 46bda313d682faa5cfb707438154be9ef5c55efd Mon Sep 17 00:00:00 2001 From: derrod Date: Wed, 1 Jun 2022 10:11:16 +0200 Subject: [PATCH] [core] Suggest alternative executables when 2K launcher is found --- legendary/core.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/legendary/core.py b/legendary/core.py index 490fc74..d720b6f 100644 --- a/legendary/core.py +++ b/legendary/core.py @@ -1532,7 +1532,21 @@ class LegendaryCore: # Detect 2K launcher, warn about it if '2klauncher' in install.executable.lower(): results.warnings.add('This game uses the 2K Launcher which is does not work with Legendary. ' - 'See the Legendary or EpicLinux Wiki for workarounds (e.g. exe override)') + 'Consult the Legendary or EpicLinux Wikis for workarounds (e.g. exe override).') + # suggest alternative EXEs + alts = [] + all_files = analysis.manifest_comparison.added \ + | analysis.manifest_comparison.unchanged \ + | analysis.manifest_comparison.changed + for fname in sorted(all_files): + if (fname_l := fname.lower()).endswith('.exe'): + if 'prereq' in fname_l or '2klauncher' in fname_l: + continue + alts.append(fname) + # todo move this to "install" command as an interactive selection + alt_str = '\n'.join(f' + {alt}' for alt in alts) + results.warnings.add('You may want to consider trying one of the following executables ' + f'("--override-exe" launch parameter or "override_exe" config option):\n{alt_str}') return results