mirror of
https://github.com/derrod/legendary.git
synced 2025-01-18 13:17:09 +00:00
[core] Resolve WINE dos device mappings
This commit is contained in:
parent
5f2da28f51
commit
f8f134dd4b
|
@ -928,23 +928,26 @@ class LegendaryCore:
|
||||||
# convert egl json file
|
# convert egl json file
|
||||||
lgd_igame = egl_game.to_lgd_igame()
|
lgd_igame = egl_game.to_lgd_igame()
|
||||||
|
|
||||||
# fix path on Linux if the game is installed inside the wine prefix
|
# fix path on Linux if the game is installed to a Windows drive mapping
|
||||||
if os.name != 'nt' and not lgd_igame.install_path.startswith('/'):
|
if os.name != 'nt' and not lgd_igame.install_path.startswith('/'):
|
||||||
# todo use ${WINEPREFIX}/dosdevices to make sure this is correct
|
drive_letter = lgd_igame.install_path[:2].lower()
|
||||||
if lgd_igame.install_path.startswith('Z:'):
|
drive_c_path = self.egl.programdata_path.partition('ProgramData')[0]
|
||||||
new_path = lgd_igame.install_path[2:].replace('\\', '/')
|
wine_pfx = os.path.realpath(os.path.join(drive_c_path, '..'))
|
||||||
else:
|
mapped_path = os.path.realpath(os.path.join(wine_pfx, 'dosdevices', drive_letter))
|
||||||
wine_pfx = self.egl.programdata_path.partition('ProgramData')[0]
|
if 'dosdevices' in mapped_path:
|
||||||
new_path = os.path.join(wine_pfx,
|
self.log.error(f'Unable to resolve path for mapped drive "{drive_letter}" '
|
||||||
lgd_igame.install_path.replace('\\', '/')[2:].lstrip('/'))
|
f'for WINE prefix at "{wine_pfx}"')
|
||||||
|
return
|
||||||
|
|
||||||
|
game_path = lgd_igame.install_path[2:].replace('\\', '/').lstrip('/')
|
||||||
|
new_path = os.path.realpath(os.path.join(mapped_path, game_path))
|
||||||
self.log.info(f'Adjusted game install path from "{lgd_igame.install_path}" to "{new_path}"')
|
self.log.info(f'Adjusted game install path from "{lgd_igame.install_path}" to "{new_path}"')
|
||||||
lgd_igame.install_path = new_path
|
lgd_igame.install_path = new_path
|
||||||
|
|
||||||
# check if manifest exists
|
# check if manifest exists
|
||||||
manifest_filename = os.path.join(lgd_igame.install_path, '.egstore', f'{lgd_igame.egl_guid}.manifest')
|
manifest_filename = os.path.join(lgd_igame.install_path, '.egstore', f'{lgd_igame.egl_guid}.manifest')
|
||||||
if not os.path.exists(manifest_filename):
|
if not os.path.exists(manifest_filename):
|
||||||
self.log.error(f'Game Manifest "{manifest_filename}" not found, cannot import!')
|
self.log.warning(f'Game Manifest "{manifest_filename}" not found, cannot import!')
|
||||||
return
|
return
|
||||||
|
|
||||||
# load manifest file and copy it over
|
# load manifest file and copy it over
|
||||||
|
|
Loading…
Reference in a new issue