[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.
This commit is contained in:
derrod 2022-06-24 13:48:44 +02:00
parent e5ec8e25b3
commit 7a617d35f3

View file

@ -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,7 +2924,9 @@ def main():
continue
print(f'\nCommand: {choice}')
print(subparser.format_help())
elif os.name == 'nt' and double_clicked():
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'])