зеркало из https://github.com/mozilla/pjs.git
bug 506763 - wgetcwd implementation in the WinCE shunt is broken in some circumstances r=dougt
This commit is contained in:
Родитель
626781479c
Коммит
142cea7ad9
|
@ -115,17 +115,19 @@ int errno = 0;
|
|||
|
||||
unsigned short * _wgetcwd(unsigned short * dir, unsigned long size)
|
||||
{
|
||||
if (!dir)
|
||||
return 0;
|
||||
unsigned short tmp[MAX_PATH] = {0};
|
||||
GetEnvironmentVariableW(L"CWD", tmp, size);
|
||||
if (tmp && tmp[0]) {
|
||||
if (wcslen(tmp) > size)
|
||||
return 0;
|
||||
if (!dir)
|
||||
dir = (unsigned short*)malloc(sizeof(unsigned short) * (wcslen(tmp) + 1));
|
||||
wcscpy(dir, tmp);
|
||||
return dir;
|
||||
}
|
||||
unsigned long i;
|
||||
if (!dir)
|
||||
dir = (unsigned short*)malloc(sizeof(unsigned short) * (MAX_PATH + 1));
|
||||
GetModuleFileName(GetModuleHandle (NULL), dir, MAX_PATH);
|
||||
for (i = _tcslen(dir); i && dir[i] != TEXT('\\'); i--) {}
|
||||
dir[i + 1] = TCHAR('\0');
|
||||
|
|
Загрузка…
Ссылка в новой задаче