mirror of
https://github.com/derrod/legendary.git
synced 2024-12-22 01:45:28 +00:00
[cli] Allow some eos-overlay commands to work without a prefix
This commit is contained in:
parent
496bda3345
commit
594e60e850
|
@ -2093,14 +2093,6 @@ class LegendaryCLI:
|
||||||
args.prefix = self.core.lgd.config.get(f'{app_name}.env', 'WINEPREFIX', fallback=None)
|
args.prefix = self.core.lgd.config.get(f'{app_name}.env', 'WINEPREFIX', fallback=None)
|
||||||
args.prefix = self.core.lgd.config.get(app_name, 'wine_prefix', fallback=args.prefix)
|
args.prefix = self.core.lgd.config.get(app_name, 'wine_prefix', fallback=args.prefix)
|
||||||
|
|
||||||
if not args.prefix and not args.bottle:
|
|
||||||
# try using defaults if they exist
|
|
||||||
if sys_platform == 'darwin':
|
|
||||||
args.bottle = self.core.lgd.config.get('default', 'crossover_bottle', fallback=None)
|
|
||||||
|
|
||||||
args.prefix = self.core.lgd.config.get('default.env', 'WINEPREFIX', fallback=None)
|
|
||||||
args.prefix = self.core.lgd.config.get('default', 'wine_prefix', fallback=args.prefix)
|
|
||||||
|
|
||||||
if sys_platform == 'darwin' and args.bottle:
|
if sys_platform == 'darwin' and args.bottle:
|
||||||
if not mac_is_valid_bottle(args.bottle):
|
if not mac_is_valid_bottle(args.bottle):
|
||||||
logger.error('Invalid bottle specified.')
|
logger.error('Invalid bottle specified.')
|
||||||
|
@ -2111,19 +2103,18 @@ class LegendaryCLI:
|
||||||
logger.error(f'Prefix "{args.prefix}" does not exist.')
|
logger.error(f'Prefix "{args.prefix}" does not exist.')
|
||||||
return
|
return
|
||||||
prefix = args.prefix
|
prefix = args.prefix
|
||||||
else:
|
elif args.action not in {'info', 'install', 'remove', 'update'}:
|
||||||
logger.error('Need either config default, --prefix, --bottle, or --app to install the overlay to.')
|
logger.error('Need either --prefix, --bottle, or --app for this command.')
|
||||||
return
|
return
|
||||||
|
|
||||||
if not os.path.exists(prefix):
|
if prefix:
|
||||||
logger.error(f'Prefix "{prefix}" does not exist.')
|
if not os.path.exists(prefix):
|
||||||
return
|
logger.error(f'Prefix "{prefix}" does not exist.')
|
||||||
else:
|
return
|
||||||
logger.info(f'Using prefix "{prefix}"')
|
else:
|
||||||
|
logger.info(f'Using prefix "{prefix}"')
|
||||||
|
|
||||||
if args.action == 'info':
|
if args.action == 'info':
|
||||||
reg_paths = query_registry_entries(prefix)
|
|
||||||
available_installs = self.core.search_overlay_installs(prefix)
|
|
||||||
igame = self.core.lgd.get_overlay_install_info()
|
igame = self.core.lgd.get_overlay_install_info()
|
||||||
if not igame:
|
if not igame:
|
||||||
logger.info('No Legendary-managed installation found.')
|
logger.info('No Legendary-managed installation found.')
|
||||||
|
@ -2131,6 +2122,11 @@ class LegendaryCLI:
|
||||||
logger.info(f'Installed version: {igame.version}')
|
logger.info(f'Installed version: {igame.version}')
|
||||||
logger.info(f'Installed path: {igame.install_path}')
|
logger.info(f'Installed path: {igame.install_path}')
|
||||||
|
|
||||||
|
if os.name != 'nt' and not prefix:
|
||||||
|
return
|
||||||
|
|
||||||
|
reg_paths = query_registry_entries(prefix)
|
||||||
|
available_installs = self.core.search_overlay_installs(prefix)
|
||||||
logger.info('Found available Overlay installations in:')
|
logger.info('Found available Overlay installations in:')
|
||||||
for install in available_installs:
|
for install in available_installs:
|
||||||
logger.info(f' - {install}')
|
logger.info(f' - {install}')
|
||||||
|
@ -2202,6 +2198,11 @@ class LegendaryCLI:
|
||||||
print('Aborting...')
|
print('Aborting...')
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if os.name != 'nt' and not prefix:
|
||||||
|
logger.info('Registry entries in prefixes (if any) have not been removed. '
|
||||||
|
f'This shoouldn\'t cause any issues as the overlay will simply fail to load.')
|
||||||
|
return
|
||||||
|
|
||||||
logger.info('Removing registry entries...')
|
logger.info('Removing registry entries...')
|
||||||
remove_registry_entries(prefix)
|
remove_registry_entries(prefix)
|
||||||
|
|
||||||
|
@ -2243,21 +2244,25 @@ class LegendaryCLI:
|
||||||
logger.error(f'The following exception occurred while waiting for the downloader to finish: {e!r}. '
|
logger.error(f'The following exception occurred while waiting for the downloader to finish: {e!r}. '
|
||||||
f'Try restarting the process, if it continues to fail please open an issue on GitHub.')
|
f'Try restarting the process, if it continues to fail please open an issue on GitHub.')
|
||||||
else:
|
else:
|
||||||
logger.info('Finished downloading, setting up overlay...')
|
|
||||||
self.core.finish_overlay_install(igame)
|
self.core.finish_overlay_install(igame)
|
||||||
|
|
||||||
# Check for existing registry entries, and remove them if necessary
|
if os.name == 'nt' or prefix:
|
||||||
install_path = os.path.normpath(igame.install_path)
|
logger.info('Finished downloading, setting up overlay...')
|
||||||
reg_paths = query_registry_entries(prefix)
|
# Check for existing registry entries, and remove them if necessary
|
||||||
if old_path := reg_paths["overlay_path"]:
|
install_path = os.path.normpath(igame.install_path)
|
||||||
if os.path.normpath(old_path) != install_path:
|
reg_paths = query_registry_entries(prefix)
|
||||||
logger.info(f'Updating overlay registry entries from "{old_path}" to "{install_path}"')
|
if old_path := reg_paths["overlay_path"]:
|
||||||
remove_registry_entries(prefix)
|
if os.path.normpath(old_path) != install_path:
|
||||||
else:
|
logger.info(f'Updating overlay registry entries from "{old_path}" to "{install_path}"')
|
||||||
logger.info(f'Registry entries already exist. Done.')
|
remove_registry_entries(prefix)
|
||||||
return
|
else:
|
||||||
add_registry_entries(install_path, prefix)
|
logger.info(f'Registry entries already exist. Done.')
|
||||||
logger.info('Done.')
|
return
|
||||||
|
add_registry_entries(install_path, prefix)
|
||||||
|
logger.info('Done.')
|
||||||
|
else:
|
||||||
|
logger.info('Overlay has been downloaded. Run "legendary eos-overlay enable -h" to see '
|
||||||
|
'available options for enabling the overlay by specifying a prefix, app, or bottle.')
|
||||||
|
|
||||||
def crossover_setup(self, args):
|
def crossover_setup(self, args):
|
||||||
if sys_platform != 'darwin':
|
if sys_platform != 'darwin':
|
||||||
|
|
Loading…
Reference in a new issue