MCPcopy
hub / github.com/legendary-gl/legendary / egs_sync

Method egs_sync

legendary/cli.py:1404–1555  ·  view source on GitHub ↗
(self, args)

Source from the content-addressed store, hash-verified

1402 logger.info(f'{"DLC" if game.is_dlc else "Game"} "{game.app_title}" has been imported.')
1403
1404 def egs_sync(self, args):
1405 if not self.core.lgd.lock_installed():
1406 logger.fatal('Failed to acquire installed data lock, only one instance of Legendary may '
1407 'install/import/move applications at a time.')
1408 return
1409
1410 if args.unlink:
1411 logger.info('Unlinking and resetting EGS and LGD sync...')
1412 self.core.lgd.config.remove_option('Legendary', 'egl_programdata')
1413 self.core.lgd.config.remove_option('Legendary', 'egl_sync')
1414 # remove EGL GUIDs from all games, DO NOT remove .egstore folders because that would fuck things up.
1415 for igame in self.core.get_installed_list():
1416 if not igame.egl_guid:
1417 continue
1418 igame.egl_guid = ''
1419 self.core.install_game(igame)
1420 # todo track which games were imported, remove those from LGD and exported ones from EGL
1421 logger.info('NOTE: All games are still available in Legendary and EGL, but future changes '
1422 'will not be synced. This may cause issues when trying to update/uninstall games.')
1423 return
1424 elif args.disable_sync:
1425 logger.info('Disabling EGS/LGD sync...')
1426 self.core.lgd.config.remove_option('Legendary', 'egl_sync')
1427 return
1428
1429 if not self.core.lgd.assets:
1430 logger.error('Legendary is missing game metadata, please login (if not already) and use the '
1431 '"status" command to fetch necessary information to set-up syncing.')
1432 return
1433
1434 if args.migrate:
1435 logger.info('Migration enabled, this will remove the games from EGL, but not uninstall them.')
1436 args.import_only = args.one_shot = True
1437
1438 if not self.core.egl.programdata_path:
1439 if not args.egl_manifest_path and not args.egl_wine_prefix:
1440 # search default Lutris install path
1441 lutris_data_path = os.path.expanduser('~/Games/epic-games-store/drive_c/ProgramData'
1442 '/Epic/EpicGamesLauncher/Data')
1443 egl_path = None
1444 if os.path.exists(lutris_data_path):
1445 logger.info(f'Found Lutris EGL install at "{lutris_data_path}"')
1446
1447 if args.yes or get_boolean_choice('Do you want to use the Lutris install?'):
1448 egl_path = os.path.join(lutris_data_path, 'Manifests')
1449 if not os.path.exists(egl_path):
1450 print('EGL Data path exists but Manifests directory is missing, creating...')
1451 os.makedirs(egl_path)
1452
1453 if not egl_path:
1454 print('EGL path not found, please manually provide the path to the WINE prefix it is installed in')
1455 egl_path = input('Path [empty input to quit]: ').strip()
1456 if not egl_path:
1457 print('Empty input, quitting...')
1458 exit(0)
1459 if not os.path.exists(egl_path):
1460 print('Path is invalid (does not exist)!')
1461 exit(1)

Callers 1

mainFunction · 0.95

Calls 13

get_boolean_choiceFunction · 0.90
lock_installedMethod · 0.80
infoMethod · 0.80
remove_optionMethod · 0.80
setMethod · 0.80
egl_get_importableMethod · 0.80
egl_importMethod · 0.80
egl_get_exportableMethod · 0.80
egl_exportMethod · 0.80
egl_syncMethod · 0.80
egl_uninstallMethod · 0.80
get_installed_listMethod · 0.45

Tested by

no test coverage detected