Change WINEPREFIX variable when double clicking .exe file

Questions about Wine on Linux
Post Reply
User avatar
Livy
Level 1
Level 1
Posts: 9
Joined: Sat May 04, 2019 8:25 am
Location: Hanoi, Vietnam

Change WINEPREFIX variable when double clicking .exe file

Post by Livy » Tue Jul 16, 2019 11:29 pm

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 6
Level 6
Posts: 695
Joined: Thu Aug 14, 2014 10:10 am

Re: Change WINEPREFIX variable when double clicking .exe fil

Post by jkfloris » Wed Jul 17, 2019 4:00 am

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
Location: Hanoi, Vietnam

Re: Change WINEPREFIX variable when double clicking .exe fil

Post by Livy » Mon Jul 22, 2019 8:39 pm

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.

Post Reply