Skip to content

Commit abd3a9d

Browse files
CommandMCderrod
authored andcommitted
[core] Save path resolution: Fallback to reading wine prefix from env vars
This is mainly something for Heroic, since we don't touch config.ini
1 parent 53e2acc commit abd3a9d

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

legendary/core.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -863,6 +863,18 @@ def get_save_path(self, app_name, platform='Windows'):
863863
wine_pfx = self.lgd.config.get('default.env', 'WINEPREFIX', fallback=None)
864864
wine_pfx = self.lgd.config.get('default', 'wine_prefix', fallback=wine_pfx)
865865

866+
# If we still didn't find anything, try to read the prefix from the environment variables of this process
867+
if not wine_pfx and sys_platform == 'darwin':
868+
cx_bottle = os.getenv('CX_BOTTLE')
869+
if cx_bottle and mac_is_valid_bottle(cx_bottle):
870+
wine_pfx = mac_get_bottle_path(cx_bottle)
871+
872+
if not wine_pfx:
873+
proton_pfx = os.getenv('STEAM_COMPAT_DATA_PATH')
874+
if proton_pfx:
875+
wine_pfx = f'{proton_pfx}/pfx'
876+
wine_pfx = os.getenv('WINEPREFIX', wine_pfx)
877+
866878
# if all else fails, use the WINE default
867879
if not wine_pfx:
868880
wine_pfx = os.path.expanduser('~/.wine')

0 commit comments

Comments
 (0)