[cli/core] Add flag to disable WINE

This commit is contained in:
derrod 2020-05-23 18:29:43 +02:00
parent 76a0ef6be7
commit 6c9e3a1d62
2 changed files with 10 additions and 4 deletions

View file

@ -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='<wine pfx path>',
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='<Platform>',
type=str, help='Override platform that games are shown for')

View file

@ -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')