Skip to content

Commit c53ac14

Browse files
committed
[cli] Catch exception if EGL path resolution fails
1 parent d302667 commit c53ac14

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

legendary/cli.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,16 @@ def auth(self, args):
8787
print('Path is invalid (does not exist)!')
8888
exit(1)
8989

90-
wine_folders = get_shell_folders(read_registry(egl_wine_pfx), egl_wine_pfx)
91-
egl_appdata = os.path.realpath(os.path.join(wine_folders['Local AppData'],
92-
'EpicGamesLauncher', 'Saved',
93-
'Config', 'Windows'))
90+
try:
91+
wine_folders = get_shell_folders(read_registry(egl_wine_pfx), egl_wine_pfx)
92+
egl_appdata = os.path.realpath(os.path.join(wine_folders['Local AppData'],
93+
'EpicGamesLauncher', 'Saved',
94+
'Config', 'Windows'))
95+
except Exception as e:
96+
logger.error(f'Got exception when trying to read WINE registry: {e!r}')
97+
logger.error('Make sure you are specifying a valid wine prefix.')
98+
exit(1)
99+
94100
if not os.path.exists(egl_appdata):
95101
logger.error(f'Wine prefix does not have EGL appdata path at "{egl_appdata}"')
96102
exit(0)

0 commit comments

Comments
 (0)