[PATCH v2 0/2] MR10543: Change default dir to ~/.local/share/wine
I switched it to `~/.local/share/wine` to fit XDG. I will edit all the docs and what not if `~/.local/share/wine` is see fit by maintainers. Soo please let me know if it's fit or not {width=900 height=234} If $XDG_DATA_HOME isn't set on the machine + .local doesn't exist it uses the current `$HOME/.wine` Related issue (please see beforehand): https://bugs.winehq.org/show_bug.cgi?id=48955 -- v2: Stop hardcoding https://gitlab.winehq.org/wine/wine/-/merge_requests/10543
From: Twig6943 <119701717+Twig6943@users.noreply.github.com> --- dlls/mountmgr.sys/unixlib.c | 2 +- dlls/ntdll/unix/loader.c | 2 +- server/request.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dlls/mountmgr.sys/unixlib.c b/dlls/mountmgr.sys/unixlib.c index 2a5fd272db6..f84027f36ef 100644 --- a/dlls/mountmgr.sys/unixlib.c +++ b/dlls/mountmgr.sys/unixlib.c @@ -99,7 +99,7 @@ static char *get_dosdevices_path( const char *dev ) if (prefix) asprintf( &path, "%s/dosdevices/%s", prefix, dev ); else - asprintf( &path, "%s/.wine/dosdevices/%s", getenv( "HOME" ), dev ); + asprintf( &path, "%s/.local/share/wine/dosdevices/%s", getenv( "HOME" ), dev ); return path; } diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index b66be2bb06e..914eb9a0116 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -378,7 +378,7 @@ static void set_config_dir(void) { if (!home_dir) fatal_error( "could not determine your home directory\n" ); if (home_dir[0] != '/') fatal_error( "the home directory %s is not an absolute path\n", home_dir ); - config_dir = build_path( home_dir, ".wine" ); + config_dir = build_path( home_dir, ".local/share/wine" ); } } diff --git a/server/request.c b/server/request.c index 994169a0565..18031abcaa1 100644 --- a/server/request.c +++ b/server/request.c @@ -619,10 +619,10 @@ static char *create_server_dir( int force ) } if (!home) fatal_error( "could not determine your home directory\n" ); if (home[0] != '/') fatal_error( "your home directory %s is not an absolute path\n", home ); - if (!(config_dir = malloc( strlen(home) + sizeof("/.wine") ))) fatal_error( "out of memory\n" ); + if (!(config_dir = malloc( strlen(home) + sizeof("/.local/share/wine") ))) fatal_error( "out of memory\n" ); strcpy( config_dir, home ); for (p = config_dir + strlen(config_dir); p > config_dir; p--) if (p[-1] != '/') break; - strcpy( p, "/.wine" ); + strcpy( p, "/.local/share/wine" ); } if (chdir( config_dir ) == -1) -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10543
From: Twig6943 <119701717+Twig6943@users.noreply.github.com> --- dlls/mountmgr.sys/unixlib.c | 21 +++++++++++++++++++-- dlls/ntdll/unix/loader.c | 13 ++++++++++++- server/request.c | 26 ++++++++++++++++++++++---- 3 files changed, 53 insertions(+), 7 deletions(-) diff --git a/dlls/mountmgr.sys/unixlib.c b/dlls/mountmgr.sys/unixlib.c index f84027f36ef..e1b10169c92 100644 --- a/dlls/mountmgr.sys/unixlib.c +++ b/dlls/mountmgr.sys/unixlib.c @@ -99,8 +99,25 @@ static char *get_dosdevices_path( const char *dev ) if (prefix) asprintf( &path, "%s/dosdevices/%s", prefix, dev ); else - asprintf( &path, "%s/.local/share/wine/dosdevices/%s", getenv( "HOME" ), dev ); - + { + const char *xdg_data_home = getenv( "XDG_DATA_HOME" ); + const char *home = getenv( "HOME" ); + char *data_home; + struct stat st; + if (xdg_data_home && xdg_data_home[0] == '/') + { + if (!(data_home = strdup( xdg_data_home ))) return NULL; + } + else + { + if (!home || asprintf( &data_home, "%s/.local/share", home ) == -1) return NULL; + } + if (stat( data_home, &st ) == 0 && S_ISDIR(st.st_mode)) + asprintf( &path, "%s/wine/dosdevices/%s", data_home, dev ); + else if (home) + asprintf( &path, "%s/.wine/dosdevices/%s", home, dev ); + free( data_home ); + } return path; } diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index 914eb9a0116..1b9d1522537 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -376,9 +376,20 @@ static void set_config_dir(void) } else { + const char *xdg_data_home = getenv( "XDG_DATA_HOME" ); + char *data_home; + struct stat st; if (!home_dir) fatal_error( "could not determine your home directory\n" ); if (home_dir[0] != '/') fatal_error( "the home directory %s is not an absolute path\n", home_dir ); - config_dir = build_path( home_dir, ".local/share/wine" ); + if (xdg_data_home && xdg_data_home[0] == '/') + data_home = strdup( xdg_data_home ); + else + data_home = build_path( home_dir, ".local/share" ); + if (stat( data_home, &st ) == 0 && S_ISDIR(st.st_mode)) + config_dir = build_path( data_home, "wine" ); + else + config_dir = build_path( home_dir, ".wine" ); + free( data_home ); } } diff --git a/server/request.c b/server/request.c index 18031abcaa1..7d2eae5bec5 100644 --- a/server/request.c +++ b/server/request.c @@ -612,6 +612,8 @@ static char *create_server_dir( int force ) else { const char *home = getenv( "HOME" ); + const char *xdg_data_home = getenv( "XDG_DATA_HOME" ); + char *data_home; if (!home) { struct passwd *pwd = getpwuid( getuid() ); @@ -619,10 +621,26 @@ static char *create_server_dir( int force ) } if (!home) fatal_error( "could not determine your home directory\n" ); if (home[0] != '/') fatal_error( "your home directory %s is not an absolute path\n", home ); - if (!(config_dir = malloc( strlen(home) + sizeof("/.local/share/wine") ))) fatal_error( "out of memory\n" ); - strcpy( config_dir, home ); - for (p = config_dir + strlen(config_dir); p > config_dir; p--) if (p[-1] != '/') break; - strcpy( p, "/.local/share/wine" ); + if (xdg_data_home && xdg_data_home[0] == '/') + { + if (!(data_home = strdup( xdg_data_home ))) fatal_error( "out of memory\n" ); + } + else + { + if (asprintf( &data_home, "%s/.local/share", home ) == -1) fatal_error( "out of memory\n" ); + } + if (stat( data_home, &st ) == 0 && S_ISDIR(st.st_mode)) + { + if (asprintf( &config_dir, "%s/wine", data_home ) == -1) fatal_error( "out of memory\n" ); + } + else + { + if (!(config_dir = malloc( strlen(home) + sizeof("/.wine") ))) fatal_error( "out of memory\n" ); + strcpy( config_dir, home ); + for (p = config_dir + strlen(config_dir); p > config_dir; p--) if (p[-1] != '/') break; + strcpy( p, "/.wine" ); + } + free( data_home ); } if (chdir( config_dir ) == -1) -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10543
On Thu Apr 2 13:26:30 2026 +0000, Fatih Bakal wrote:
The latest commit seems good? I think keeping $HOME/.wine as a fallback is also good for Linux/BSD desktops that don't support XDG (headless server?). For macOS, maybe we will prefer using something like "\$HOME/Library/Application\ Support/Wine" instead.
Personally, changes like this for reducing dot files/folders under $HOME are welcome to me, but there is a concern that users will lose their configuration and applications in the old wine prefix if they don't notice this change and copy their wine prefix to the new location, this can be confusing. Please also squash patches that are for the same purpose into a single commit. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10543#note_134825
On Thu Apr 2 14:31:29 2026 +0000, Jactry Zeng wrote:
I think keeping $HOME/.wine as a fallback is also good for Linux/BSD desktops that don't support XDG (headless server?). For macOS, maybe we will prefer using something like "\$HOME/Library/Application\ Support/Wine" instead. Personally, changes like this for reducing dot files/folders under $HOME are welcome to me, but there is a concern that users will lose their configuration and applications in the old wine prefix if they don't notice this change and copy their wine prefix to the new location, this can be confusing. Please also squash patches that are for the same purpose into a single commit. I'd prefer using $HOME/.wine/ if it exists, but never creating it; if it doesn't, use $XDG_DATA_DIR/wine/, or $HOME/.local/share/wine/ if that env isn't set either. My system (Debian+MATE) has a well populated ~/.local/share/, but doesn't set $XDG_DATA_DIR.
Also, if we're going to consider four or five locations ($WINEPREFIX, $HOME/.wine/, $XDG_DATA_HOME/wine/, $HOME/.local/share/wine/, $HOME/Library/Application Support/Wine/), we should probably not duplicate that logic three times. Better refactor it to a shared function. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10543#note_134830
On Thu Apr 2 15:00:34 2026 +0000, Alfred Agrell wrote:
I'd prefer using $HOME/.wine/ if it exists, but never creating it; if it doesn't, use $XDG_DATA_DIR/wine/, or $HOME/.local/share/wine/ if that env isn't set either. My system (Debian+MATE) has a well populated ~/.local/share/, but doesn't set $XDG_DATA_DIR. Also, if we're going to consider four or five locations ($WINEPREFIX, $HOME/.wine/, $XDG_DATA_HOME/wine/, $HOME/.local/share/wine/, $HOME/Library/Application Support/Wine/), we should probably not duplicate that logic three times. Better refactor it to a shared function. @jactry will squash once I'm it's done (still waiting on word from upstream people as I said)
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/10543#note_134831
On Thu Apr 2 15:05:09 2026 +0000, Fatih Bakal wrote:
@jactry will squash once I'm it's done (still waiting on word from upstream people as I said) Also I dont have mac hardware to test not to mention I think apple stuff isn't worth touching (not gonna rant why here)
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/10543#note_134834
Been a month, bump. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10543#note_138477
I came here after an IRC request for help on bug 48506. I am not the one who can make the ultimate decision either, but I don't think this is something we want to change at this point. To summarise the issues pointed out so far: 1) What about non-Linux OSes? While it is legitimate to not care about them as an individual contributor, as a project we do care, so a change that affects other OSes should be made by someone who understands and can test the impact. 2) What about existing prefixes? 3) And to add an unspoken concern: What exact problem are you solving, and are you sure you are not just replacing it with different issues. Yes the XDG spec is a thing, and I like that programs (slowly) stop spamming my $HOME with .files and .folders. Wine exists way longer than XDG though and has a grown ecosystem of third party tools to manage its prefixes. We have to keep those in mind too. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10543#note_139365
Asked here: https://bugs.winehq.org/show_bug.cgi?id=59739#c4 Would a winecfg command line theme option be better since it already supports setting versions `winecfg /v win10`? ``` WINEPREFIX=/bogus/pfx_0 wine winecfg /t aero WINEPREFIX=/bogus/pfx_1 wine winecfg /t aero WINEPREFIX=/bogus/pfx_2 wine winecfg /t aero_dark ``` -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10543#note_139372
Yo! Instead of changing Wine's default behavior, which is to use the `$HOME/.wine` folder on Linux, would it be possible to have an environment variable to use `XDG_DATA_HOME/wine` if WINEPREFIX is not defined? I imagine it would be better to have something that can be enabled, rather than something that changes the default behavior. I know that not using XDG_DATA_HOME is seen as a problem, but Wine is also used via launchers, which generally avoid `$HOME/.wine` and even allow the user to choose which folder to use as a prefix. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10543#note_139373
On Sun May 10 14:02:18 2026 +0000, Stian Low wrote:
Asked here: https://bugs.winehq.org/show_bug.cgi?id=59739#c4 Would a winecfg command line theme option be better since it already supports setting versions `winecfg /v win10`? ``` WINEPREFIX=/bogus/pfx_0 wine winecfg /t aero WINEPREFIX=/bogus/pfx_1 wine winecfg /t aero WINEPREFIX=/bogus/pfx_2 wine winecfg /t aero_dark ``` As proposed here: https://bugs.winehq.org/show_bug.cgi?id=59739#c5
In addition to adding winecfg /t theme options for convenience, adding another flag that either replaces `/bogus_pfx_0/drive_c/windows/resources/themes` with a symlink or uses the path as the basis for Themes dropdown and /t option seem like may resolve inconveniences. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10543#note_139376
winecfg seems better suited for handling this task than any changes outside of it. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10543#note_139377
If merge request is supposed to address something other than theme setting conveniences reported for https://bugs.winehq.org/show_bug.cgi?id=59739 then existing XDG handling found here may be helpful which I found following winecfg code: https://gitlab.winehq.org/wine/wine/-/blob/master/dlls/shell32/shellpath.c?r... -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10543#note_139378
Instead of changing Wine's default behavior, which is to use the `$HOME/.wine` folder on Linux, would it be possible to have an environment variable to use `XDG_DATA_HOME/wine` if WINEPREFIX is not defined?
For sure. but the plan was to somewhat just move past using $HOME/.wine and I never got word from somebody with merge rights on what to do
I know that not using XDG_DATA_HOME is seen as a problem, but Wine is also used via launchers, which generally avoid `$HOME/.wine` and even allow the user to choose which folder to use as a prefix.
Yea I know and the only prefix I have in $HOME is the default one, thus existence of the pr/issue -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10543#note_139386
Instead of changing Wine's default behavior, which is to use the `$HOME/.wine` folder on Linux, would it be possible to have an environment variable to use `XDG_DATA_HOME/wine` if WINEPREFIX is not defined?
What differentiates this from "WINEPREFIX=$XDG_DATA_HOME/wine"? -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10543#note_139434
On Mon May 11 16:47:12 2026 +0000, Elizabeth Figura wrote:
Instead of changing Wine's default behavior, which is to use the `$HOME/.wine` folder on Linux, would it be possible to have an environment variable to use `XDG_DATA_HOME/wine` if WINEPREFIX is not defined? What differentiates this from "WINEPREFIX=$XDG_DATA_HOME/wine"? Pretty much nothing and `WINEPREFIX=$XDG_DATA_HOME/wine` can be set even as of right now with current builds but the deal is kinda to switch the default dir like the title of the pr says
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/10543#note_139494
Pretty much nothing and WINEPREFIX=$XDG_DATA_HOME/wine can be set even as of right now with current builds but the deal is kinda to switch the default dir like the title of the pr says
Given the backwards compatibility issues, it doesn't seem worth the trouble. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10543#note_139535
On Tue May 12 06:53:43 2026 +0000, Alexandre Julliard wrote:
Pretty much nothing and WINEPREFIX=$XDG_DATA_HOME/wine can be set even as of right now with current builds but the deal is kinda to switch the default dir like the title of the pr says Given the backwards compatibility issues, it doesn't seem worth the trouble. @julliard should I close this MR then?
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/10543#note_139551
This merge request was closed by Alexandre Julliard. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10543
participants (9)
-
Alexandre Julliard (@julliard) -
Alfred Agrell (@Alcaro) -
Elizabeth Figura (@zfigura) -
Fatih Bakal (@Twig) -
Jactry Zeng (@jactry) -
Kyuyrii (@Kyuyrii) -
Stefan Dösinger (@stefan) -
Stian Low (@stianlow) -
Twig6943