@@ -1310,11 +1310,13 @@ def egs_sync(self, args):
13101310 self .core .lgd .config .remove_option ('Legendary' , 'egl_sync' )
13111311 # remove EGL GUIDs from all games, DO NOT remove .egstore folders because that would fuck things up.
13121312 for igame in self .core .get_installed_list ():
1313+ if not igame .egl_guid :
1314+ continue
13131315 igame .egl_guid = ''
13141316 self .core .install_game (igame )
13151317 # todo track which games were imported, remove those from LGD and exported ones from EGL
1316- logger .info ('NOTE: Games have not been removed from the Epic Games Launcher or Legendary.' )
1317- logger . info ( 'Games will not be removed from EGL or Legendary if it was removed from the other launcher .' )
1318+ logger .info ('NOTE: All games are still available in Legendary and EGL, but future changes '
1319+ 'will not be synced. This may cause issues when trying to update/uninstall games .' )
13181320 return
13191321 elif args .disable_sync :
13201322 logger .info ('Disabling EGS/LGD sync...' )
@@ -1326,6 +1328,10 @@ def egs_sync(self, args):
13261328 '"status" command to fetch necessary information to set-up syncing.' )
13271329 return
13281330
1331+ if args .migrate :
1332+ logger .info ('Migration enabled, this will remove the games from EGL, but not uninstall them.' )
1333+ args .import_only = args .one_shot = True
1334+
13291335 if not self .core .egl .programdata_path :
13301336 if not args .egl_manifest_path and not args .egl_wine_prefix :
13311337 # search default Lutris install path
@@ -1422,12 +1428,26 @@ def egs_sync(self, args):
14221428 print ('Nothing to export.' )
14231429
14241430 print ('\n Checking automatic sync...' )
1425- if not self .core .egl_sync_enabled and not args .one_shot :
1431+ if not self .core .egl_sync_enabled and not args .one_shot and not args . migrate :
14261432 if not args .enable_sync :
14271433 args .enable_sync = args .yes or get_boolean_choice ('Enable automatic synchronization?' )
14281434 if not args .enable_sync : # if user chooses no, still run the sync once
14291435 self .core .egl_sync ()
14301436 self .core .lgd .config .set ('Legendary' , 'egl_sync' , str (args .enable_sync ))
1437+ elif args .migrate :
1438+ # migration also disables sync
1439+ logger .info ('Disabling automatic sync (if enabled) and removing EGL link to finish migration...' )
1440+ self .core .lgd .config .remove_option ('Legendary' , 'egl_programdata' )
1441+ self .core .lgd .config .remove_option ('Legendary' , 'egl_sync' )
1442+
1443+ for igame in self .core .get_installed_list ():
1444+ if not igame .egl_guid :
1445+ continue
1446+ self .core .egl_uninstall (igame )
1447+ igame .egl_guid = ''
1448+ self .core .install_game (igame )
1449+
1450+ logger .info ('Migration complete. Your games will now be exclusively managed by Legendary.' )
14311451 else :
14321452 self .core .egl_sync ()
14331453
@@ -2770,6 +2790,9 @@ def main():
27702790 help = 'Only import games from EGL (no export)' )
27712791 egl_sync_parser .add_argument ('--export-only' , dest = 'export_only' , action = 'store_true' ,
27722792 help = 'Only export games to EGL (no import)' )
2793+ egl_sync_parser .add_argument ('--migrate' , dest = 'migrate' , action = 'store_true' ,
2794+ help = 'Import games into legendary, then remove them from EGL '
2795+ '(implies --import-only --one-shot --unlink)' )
27732796 egl_sync_parser .add_argument ('--unlink' , dest = 'unlink' , action = 'store_true' ,
27742797 help = 'Disable sync and remove EGL metadata from installed games' )
27752798
0 commit comments