[cli/core] Only check CX_BOTTLE when using CrossOver wine

Addresses issues pointed out in #414
This commit is contained in:
derrod 2022-05-23 07:45:14 +02:00
parent ec91f69adc
commit 1e97a4d791
2 changed files with 9 additions and 3 deletions

View file

@ -647,7 +647,7 @@ class LegendaryCLI:
full_env = os.environ.copy() full_env = os.environ.copy()
full_env.update(params.environment) full_env.update(params.environment)
if 'CX_BOTTLE' in full_env: if 'CX_BOTTLE' in full_env and any('SharedSupport/CrossOver' in p for p in params.launch_command):
# if using crossover, unset WINEPREFIX # if using crossover, unset WINEPREFIX
full_env.pop('WINEPREFIX', None) full_env.pop('WINEPREFIX', None)
# check that bottle is valid, show error otherwise # check that bottle is valid, show error otherwise
@ -659,6 +659,8 @@ class LegendaryCLI:
else: else:
logger.error(f'Specified CrossOver bottle {bottle_name} does not exist, cannot launch.') logger.error(f'Specified CrossOver bottle {bottle_name} does not exist, cannot launch.')
exit(1) exit(1)
else:
logger.info(f'Using CrossOver Bottle "{bottle_name}"')
if args.dry_run: if args.dry_run:
logger.info(f'Not Launching {app_name} (dry run)') logger.info(f'Not Launching {app_name} (dry run)')
@ -744,7 +746,7 @@ class LegendaryCLI:
full_env = os.environ.copy() full_env = os.environ.copy()
full_env.update(env) full_env.update(env)
if 'CX_BOTTLE' in full_env: if 'CX_BOTTLE' in full_env and any('SharedSupport/CrossOver' in p for p in command):
# if using crossover, unset WINEPREFIX # if using crossover, unset WINEPREFIX
full_env.pop('WINEPREFIX', None) full_env.pop('WINEPREFIX', None)
# check that bottle is valid, show error otherwise # check that bottle is valid, show error otherwise
@ -756,6 +758,8 @@ class LegendaryCLI:
else: else:
logger.error(f'Specified CrossOver bottle {bottle_name} does not exist, cannot launch.') logger.error(f'Specified CrossOver bottle {bottle_name} does not exist, cannot launch.')
exit(1) exit(1)
else:
logger.info(f'Using CrossOver Bottle "{bottle_name}"')
if not command: if not command:
logger.error(f'In order to launch Origin correctly you must specify a prefix and wine binary or ' logger.error(f'In order to launch Origin correctly you must specify a prefix and wine binary or '

View file

@ -597,7 +597,9 @@ class LegendaryCore:
env['CX_BOTTLE'] = cx_bottle env['CX_BOTTLE'] = cx_bottle
else: else:
cx_bottle = os.environ['CX_BOTTLE'] cx_bottle = os.environ['CX_BOTTLE']
self.log.info(f'Using CrossOver Bottle "{cx_bottle}"')
if cx_bottle:
self.log.debug(f'Using CrossOver Bottle "{cx_bottle}"')
if wine_pfx: if wine_pfx:
env['WINEPREFIX'] = wine_pfx env['WINEPREFIX'] = wine_pfx