reactos/lib/sdk/crt/direct/chdir.c
Amine Khaldi c424146e2c Create a branch for cmake bringup.
svn path=/branches/cmake-bringup/; revision=48236
2010-07-24 18:52:44 +00:00

28 lines
564 B
C

#include <precomp.h>
#include <ctype.h>
#include <direct.h>
#include <tchar.h>
/*
* @implemented
*/
int _tchdir(const _TCHAR* _path)
{
WCHAR newdir[MAX_PATH];
if (!SetCurrentDirectory(_path))
{
_dosmaperr(_path ? GetLastError() : 0);
return -1;
}
/* Update the drive-specific current directory variable */
if (GetCurrentDirectoryW(MAX_PATH, newdir) && newdir[1] == L':')
{
WCHAR envvar[4] = { L'=', towupper(newdir[0]), L':', L'\0' };
SetEnvironmentVariableW(envvar, newdir);
}
return 0;
}