From 6c9e3a1d62b02d6f856fc8d16503c564d8b76287 Mon Sep 17 00:00:00 2001 From: derrod Date: Sat, 23 May 2020 18:29:43 +0200 Subject: [PATCH] [cli/core] Add flag to disable WINE --- legendary/cli.py | 8 +++++++- legendary/core.py | 6 +++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/legendary/cli.py b/legendary/cli.py index 29340b7..a5a31b3 100644 --- a/legendary/cli.py +++ b/legendary/cli.py @@ -372,7 +372,8 @@ class LegendaryCLI: params, cwd, env = self.core.get_launch_parameters(app_name=app_name, offline=args.offline, extra_args=extra, user=args.user_name_override, wine_bin=args.wine_bin, wine_pfx=args.wine_pfx, - language=args.language, wrapper=args.wrapper) + language=args.language, wrapper=args.wrapper, + disable_wine=args.no_wine) logger.info(f'Launching {app_name}...') if args.dry_run: @@ -847,10 +848,15 @@ def main(): launch_parser.add_argument('--wine-prefix', dest='wine_pfx', action='store', metavar='', default=os.environ.get('LGDRY_WINE_PREFIX', None), help='Override WINE prefix used.') + launch_parser.add_argument('--no-wine', dest='no_wine', action='store_true', + default=os.environ.get('LGDRY_NO_WINE', None), + help='Do not use WINE (e.g. if a wrapper is being used)') else: # hidden arguments to not break this on Windows launch_parser.add_argument('--wine', help=argparse.SUPPRESS, dest='wine_bin') launch_parser.add_argument('--wine-prefix', help=argparse.SUPPRESS, dest='wine_pfx') + launch_parser.add_argument('--no-wine', dest='no_wine', help=argparse.SUPPRESS, + action='store_true', default=True) list_parser.add_argument('--platform', dest='platform_override', action='store', metavar='', type=str, help='Override platform that games are shown for') diff --git a/legendary/core.py b/legendary/core.py index 4ff6c6e..ed127a0 100644 --- a/legendary/core.py +++ b/legendary/core.py @@ -230,8 +230,8 @@ class LegendaryCore: def get_launch_parameters(self, app_name: str, offline: bool = False, user: str = None, extra_args: list = None, wine_bin: str = None, wine_pfx: str = None, - language: str = None, wrapper: str = None - ) -> (list, str, dict): + language: str = None, wrapper: str = None, + disable_wine: bool = False) -> (list, str, dict): install = self.lgd.get_installed_game(app_name) game = self.lgd.get_game_meta(app_name) @@ -256,7 +256,7 @@ class LegendaryCore: if wrapper := self.lgd.config.get(app_name, 'wrapper', fallback=wrapper): params.extend(shlex.split(wrapper)) - if os.name != 'nt': + if os.name != 'nt' and not disable_wine: if not wine_bin: # check if there's a default override wine_bin = self.lgd.config.get('default', 'wine_executable', fallback='wine')