Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Save path resolution: Fallback to reading wine prefix from environment variables #461

Merged
merged 1 commit into from
Aug 6, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions legendary/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -852,6 +852,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