Change WINEPREFIX variable when double clicking .exe file

Questions about Wine on Linux
Locked
User avatar
Livy
Level 1
Level 1
Posts: 9
Joined: Sat May 04, 2019 8:25 am

Change WINEPREFIX variable when double clicking .exe file

Post by Livy »

I create a ~/.wine_x86 wineprefix and exported WINEPREFIX from from ~/.bashrc to point to that directory. I am pretty new to the concept of login/non-login shell, interactive/non-interactive shell, but from what I've studied so far, scripts inside ~/.bashrc are executed on non-login session and will be called during login session anyway. So theoretically I will have WINEPREFIX=~/.wine_x86 on all sorts of sessions.

I logged in using graphical interface, fired up a terminal, seemed good:

Code: Select all

livy@lubuntu:~$ printenv WINEPREFIX
/home/livy/.wine_x86
In fact it is good if I continue to run Wine from terminal. But if I double clicking a .exe or .lnk on the file manager, it switches back to the default ~/.wine wineprefix. It seems my code inside ~/.bashrc was not sourced in this case. Why and how can I remedy this issue?
jkfloris
Level 12
Level 12
Posts: 3141
Joined: Thu Aug 14, 2014 10:10 am

Re: Change WINEPREFIX variable when double clicking .exe fil

Post by jkfloris »

I think you could find your answer here: https://serverfault.com/questions/26180 ... and-bashrc

TL;DR
use .profile
User avatar
Livy
Level 1
Level 1
Posts: 9
Joined: Sat May 04, 2019 8:25 am

Re: Change WINEPREFIX variable when double clicking .exe fil

Post by Livy »

Thanks a lot. After further reading and investigating, it turns out that .bashrc is included in interactive non-login shells only. To ensure the variable is exported during login shells, together with its subshells, .profile is the way to go.
Locked