Skip to content

Commit 326786b

Browse files
committed
[MSVCRT] Set current dir environment variable in _wchdir
This fixes a number of failures of cmd_winetest batch.
1 parent ba93cea commit 326786b

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

dll/win32/msvcrt/dir.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,18 @@ int CDECL _wchdir(const wchar_t * newdir)
235235
msvcrt_set_errno(newdir?GetLastError():0);
236236
return -1;
237237
}
238+
#ifdef __REACTOS__
239+
/* Update the drive-specific current directory variable */
240+
WCHAR fulldir[MAX_PATH];
241+
if (GetCurrentDirectoryW(ARRAYSIZE(fulldir), fulldir) >= 2)
242+
{
243+
if (fulldir[1] == L':')
244+
{
245+
WCHAR envvar[4] = { L'=', towupper(fulldir[0]), L':', L'\0' };
246+
SetEnvironmentVariableW(envvar, fulldir);
247+
}
248+
}
249+
#endif
238250
return 0;
239251
}
240252

0 commit comments

Comments
 (0)