From 7a617d35f325b78575139dab7f588faa3a9799b3 Mon Sep 17 00:00:00 2001 From: derrod Date: Fri, 24 Jun 2022 13:48:44 +0200 Subject: [PATCH] [cli] Fix double-click check breaking macOS/Linux execution By always trying to import windows_helpers and thus winreg on non-Windows things would break. --- legendary/cli.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/legendary/cli.py b/legendary/cli.py index 0b22c75..52398a5 100644 --- a/legendary/cli.py +++ b/legendary/cli.py @@ -28,7 +28,6 @@ from legendary.utils.env import is_windows_mac_or_pyi from legendary.utils.eos import add_registry_entries, query_registry_entries, remove_registry_entries from legendary.utils.lfs import validate_files, clean_filename from legendary.utils.selective_dl import get_sdl_appname -from legendary.utils.windows_helpers import double_clicked from legendary.utils.wine_helpers import read_registry, get_shell_folders # todo custom formatter for cli logger (clean info, highlighted error/warning) @@ -2925,10 +2924,12 @@ def main(): continue print(f'\nCommand: {choice}') print(subparser.format_help()) - elif os.name == 'nt' and double_clicked(): - print('Please note that this is not the intended way to run Legendary.') - print('Follow https://github.com/derrod/legendary/wiki/Setup-Instructions to set it up properly') - subprocess.Popen(['cmd', '/K', 'echo>nul']) + elif os.name == 'nt': + from legendary.utils.windows_helpers import double_clicked + if double_clicked(): + print('Please note that this is not the intended way to run Legendary.') + print('Follow https://github.com/derrod/legendary/wiki/Setup-Instructions to set it up properly') + subprocess.Popen(['cmd', '/K', 'echo>nul']) return cli = LegendaryCLI(override_config=args.config_file, api_timeout=args.api_timeout)