Skip to content

Commit

Permalink
[core] Save path resolution: Fallback to reading wine prefix from env…
Browse files Browse the repository at this point in the history
… vars

This is mainly something for Heroic, since we don't touch config.ini
  • Loading branch information
CommandMC authored and derrod committed Sep 1, 2022
1 parent 53e2acc commit abd3a9d
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions legendary/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -863,6 +863,18 @@ def get_save_path(self, app_name, platform='Windows'):
wine_pfx = self.lgd.config.get('default.env', 'WINEPREFIX', fallback=None)
wine_pfx = self.lgd.config.get('default', 'wine_prefix', fallback=wine_pfx)

# If we still didn't find anything, try to read the prefix from the environment variables of this process
if not wine_pfx and sys_platform == 'darwin':
cx_bottle = os.getenv('CX_BOTTLE')
if cx_bottle and mac_is_valid_bottle(cx_bottle):
wine_pfx = mac_get_bottle_path(cx_bottle)

if not wine_pfx:
proton_pfx = os.getenv('STEAM_COMPAT_DATA_PATH')
if proton_pfx:
wine_pfx = f'{proton_pfx}/pfx'
wine_pfx = os.getenv('WINEPREFIX', wine_pfx)

# if all else fails, use the WINE default
if not wine_pfx:
wine_pfx = os.path.expanduser('~/.wine')
Expand Down

0 comments on commit abd3a9d

Please sign in to comment.