mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 13:51:41 +00:00
bug 506763 - wgetcwd implementation in the WinCE shunt is broken in some circumstances r=dougt
This commit is contained in:
parent
bffd894fe2
commit
7943b46da5
@ -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');
|
||||
|
Loading…
Reference in New Issue
Block a user