ntdll: Add copies of two XDG env vars to the environment, and use those in winemenubuilder and shell32.
To solve https://bugs.winehq.org/show_bug.cgi?id=49987 and https://bugs.winehq.org/show_bug.cgi?id=58023 we have to remove these two XDG variables from the environment. This is a proposal that adds copies with a different name and after this they can be removed. If this is not the right way to go I guess I will hear something?
From: Louis Lenders xerox.xerox2000x@gmail.com
To solve https://bugs.winehq.org/show_bug.cgi?id=49987 and https://bugs.winehq.org/show_bug.cgi?id=58023 we have to remove these two XDG variables from the environment. This is a proposal that adds copies with a different name and after this they can be removed. If this is not the right way to go I guess I will hear something? --- dlls/ntdll/unix/env.c | 3 ++- dlls/shell32/recyclebin.c | 2 +- programs/winemenubuilder/winemenubuilder.c | 6 +++--- 3 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/dlls/ntdll/unix/env.c b/dlls/ntdll/unix/env.c index 7193cceb87e..3d26be4b4bc 100644 --- a/dlls/ntdll/unix/env.c +++ b/dlls/ntdll/unix/env.c @@ -1112,9 +1112,10 @@ static void add_dynamic_environment( WCHAR **env, SIZE_T *pos, SIZE_T *size ) append_envA( env, pos, size, "WINEUSERLOCALE", user_locale ); append_envA( env, pos, size, "SystemDrive", "C:" ); append_envA( env, pos, size, "SystemRoot", "C:\windows" ); + append_envA( env, pos, size, "WINEXDG_DATA_DIRS", getenv("XDG_DATA_DIRS") ); + append_envA( env, pos, size, "WINEXDG_DATA_HOME", getenv("XDG_DATA_HOME") ); }
- static WCHAR *expand_value( WCHAR *env, SIZE_T size, const WCHAR *src, SIZE_T src_len ) { SIZE_T len, retlen = src_len + 1, count = 0; diff --git a/dlls/shell32/recyclebin.c b/dlls/shell32/recyclebin.c index b6d9879fa39..0c148844b00 100644 --- a/dlls/shell32/recyclebin.c +++ b/dlls/shell32/recyclebin.c @@ -104,7 +104,7 @@ static BOOL WINAPI init_trash_dirs( INIT_ONCE *once, void *param, void **context } else { - const WCHAR *data_home = _wgetenv( L"XDG_DATA_HOME" ); + const WCHAR *data_home = _wgetenv( L"WINEXDG_DATA_HOME" ); const WCHAR *fmt = L"%s/.local/share/Trash"; WCHAR *p;
diff --git a/programs/winemenubuilder/winemenubuilder.c b/programs/winemenubuilder/winemenubuilder.c index 36569fa9d5f..8ef2469e138 100644 --- a/programs/winemenubuilder/winemenubuilder.c +++ b/programs/winemenubuilder/winemenubuilder.c @@ -1721,8 +1721,8 @@ static BOOL build_native_mime_types(struct list *mime_types) WCHAR *dirs, *dir, *dos_name, *ctx, *p; BOOL ret;
- if (_wgetenv( L"XDG_DATA_DIRS" )) - dirs = xwcsdup( _wgetenv( L"XDG_DATA_DIRS" )); + if (_wgetenv( L"WINEXDG_DATA_DIRS" )) + dirs = xwcsdup( _wgetenv( L"WINEXDG_DATA_DIRS" )); else dirs = xwcsdup( L"/usr/local/share/:/usr/share/" );
@@ -2849,7 +2849,7 @@ static BOOL init_xdg(void) xdg_menu_dir[1] = '\'; /* change ??\ to \?\ */ create_directories(xdg_menu_dir);
- if ((p = _wgetenv( L"XDG_DATA_HOME" ))) + if ((p = _wgetenv( L"WINEXDG_DATA_HOME" ))) xdg_data_dir = heap_wprintf( L"\??\unix%s", p ); else xdg_data_dir = heap_wprintf( L"%s/.local/share", _wgetenv(L"WINEHOMEDIR") );