From d3c27690142ab51be80c2da49a4490cfd1e20a16 Mon Sep 17 00:00:00 2001 From: derrod Date: Sat, 30 May 2020 00:25:54 +0200 Subject: [PATCH] [core] Adjust game path when importing from EGL in WINE --- legendary/core.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/legendary/core.py b/legendary/core.py index a4d5a28..79812a0 100644 --- a/legendary/core.py +++ b/legendary/core.py @@ -881,6 +881,19 @@ class LegendaryCore: # convert egl json file lgd_igame = egl_game.to_lgd_igame() + # fix path on Linux if the game is installed inside the wine prefix + if os.name != 'nt' and not lgd_igame.install_path.startswith('/'): + # todo use ${WINEPREFIX}/dosdevices to make sure this is correct + if lgd_igame.install_path.startswith('Z:'): + new_path = lgd_igame.install_path[2:] + else: + wine_pfx = self.egl.programdata_path.partition('ProgramData')[0] + new_path = os.path.join(wine_pfx, + lgd_igame.install_path.replace('\\', '/')[2:].lstrip('/')) + + self.log.info(f'Adjusted game install path from "{lgd_igame.install_path}" to "{new_path}"') + lgd_igame.install_path = new_path + # 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):