Skip to content

Commit

Permalink
core.egl_import and export are now returning error message
Browse files Browse the repository at this point in the history
  • Loading branch information
Dummerle committed Nov 7, 2021
1 parent 93e528b commit de65141
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions legendary/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1582,8 +1582,9 @@ def egl_import(self, app_name):
try:
egl_game = self.egl.get_manifest(app_name=app_name)
except ValueError:
self.log.fatal(f'EGL Manifest for {app_name} could not be loaded, not importing!')
return
err = f'EGL Manifest for {app_name} could not be loaded, not importing!'
self.log.fatal(err)
return err
# convert egl json file
lgd_igame = egl_game.to_lgd_igame()

Expand All @@ -1594,9 +1595,9 @@ def egl_import(self, app_name):
wine_pfx = os.path.realpath(os.path.join(drive_c_path, '..'))
mapped_path = os.path.realpath(os.path.join(wine_pfx, 'dosdevices', drive_letter))
if 'dosdevices' in mapped_path:
self.log.error(f'Unable to resolve path for mapped drive "{drive_letter}" '
f'for WINE prefix at "{wine_pfx}"')
return
err = f'Unable to resolve path for mapped drive "{drive_letter}" for WINE prefix at "{wine_pfx}"'
self.log.error(err)
return err

game_path = lgd_igame.install_path[2:].replace('\\', '/').lstrip('/')
new_path = os.path.realpath(os.path.join(mapped_path, game_path))
Expand All @@ -1606,8 +1607,9 @@ def egl_import(self, app_name):
# check if manifest exists
manifest_filename = os.path.join(lgd_igame.install_path, '.egstore', f'{lgd_igame.egl_guid}.manifest')
if not os.path.exists(manifest_filename):
self.log.warning(f'Game Manifest "{manifest_filename}" not found, cannot import!')
return
err = f'Game Manifest "{manifest_filename}" not found, cannot import!'
self.log.warning(err)
return err

# load manifest file and copy it over
with open(manifest_filename, 'rb') as f:
Expand All @@ -1622,7 +1624,7 @@ def egl_import(self, app_name):

# mark game as installed
_ = self._install_game(lgd_igame)
return
return ""

def egl_export(self, app_name):
self.log.debug(f'Exporting "{app_name}" to EGL')
Expand All @@ -1631,8 +1633,9 @@ def egl_export(self, app_name):
lgd_igame = self._get_installed_game(app_name)
manifest_data, _ = self.get_installed_manifest(app_name)
if not manifest_data:
self.log.error(f'Game Manifest for "{app_name}" not found, cannot export!')
return
err = f'Game Manifest for "{app_name}" not found, cannot export!'
self.log.error(err)
return err

# create guid if it's not set already
if not lgd_igame.egl_guid:
Expand Down

0 comments on commit de65141

Please sign in to comment.