[PATCH] libwine: Add WINEUSER environment variable

Gabriel Ivăncescu gabrielopcode at gmail.com
Mon Feb 10 10:51:20 CST 2020


On 10/02/2020 16:25, Andrew Eikum wrote:
> On Mon, Feb 10, 2020 at 08:11:31AM -0600, Andrew Eikum wrote:
>> On Sat, Feb 08, 2020 at 07:59:58PM +0100, Myah Caron wrote:
>>>   * If a user would rather not use their own username in the prefix.
>>>   * If a user wants multiple users in a wine prefix (e.g. as separate
>>> profiles for programs).
>>
>> Wine doesn't handle having multiple "users" nor changing the
>> Windows-side username very well. I've forgotten the details, and
>> unfortunately didn't document them very well[1], but I remember this
>> being very problematic when we tried it for Proton. I don't think
>> adding a WINEUSER variable makes sense until multiple user profiles
>> are well supported.
>>
>> [1] Frustrating lack of information here:
>> https://github.com/ValveSoftware/Proton/issues/605#issuecomment-416249569
>>
> 
> I dug through my old emails. Apparently the games that showed a
> problem with multiple users were Mount & Blade and Mount & Blade: With
> Fire and Sword. However, I didn't document what the actual problem
> was...
> 
> Andrew
> 
>>>   * If the prefix was created with proton, which replaces the username
>>> with steamuser, this allows the data under the home directory to be
>>> usable under vanilla wine without needing symlinks or renaming the
>>> directory.
>>>   * Similarly, this allows prefixes created under a different username
>>> (e.g. transferred from a different system) to be used.
>>>
>>> Signed-off-by: Myah Caron <qsniyg at mail.com>
>>> ---
>>>   libs/wine/config.c | 4 ++--
>>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/libs/wine/config.c b/libs/wine/config.c
>>> index 2a3314cbfd..d05f021267 100644
>>> --- a/libs/wine/config.c
>>> +++ b/libs/wine/config.c
>>> @@ -263,14 +263,14 @@ static void init_paths(void)
>>>       struct stat st;
>>>
>>>       const char *home = getenv( "HOME" );
>>> -    const char *user = NULL;
>>> +    const char *user = getenv( "WINEUSER" );
>>>       const char *prefix = getenv( "WINEPREFIX" );
>>>       char uid_str[32];
>>>       struct passwd *pwd = getpwuid( getuid() );
>>>
>>>       if (pwd)
>>>       {
>>> -        user = pwd->pw_name;
>>> +        if (!user) user = pwd->pw_name;
>>>           if (!home) home = pwd->pw_dir;
>>>       }
>>>       if (!user)
>>> --
>>> 2.25.0
>>>
>>>
>>>
>>
> 

Just a hunch, but could it have to do with the registry? I notice 
there's a bunch of paths and such in each of the *.reg files that refer 
to the user. Obviously those will have to be adjusted at runtime in this 
case, right?



More information about the wine-devel mailing list