Added missing features in GetFullPathName[A/W]().

svn path=/trunk/; revision=423
This commit is contained in:
Eric Kohl 1999-04-29 23:32:27 +00:00
parent 278a6c540b
commit ddd8467f99

View file

@ -196,9 +196,26 @@ DWORD STDCALL GetFullPathNameA(LPCSTR lpFileName,
return 0; return 0;
if (isalpha(lpFileName[0]) && lpFileName[1] == ':') if (isalpha(lpFileName[0]) && lpFileName[1] == ':')
{
if (lpFileName[2] == '\\')
{ {
lstrcpyA(lpBuffer, lpFileName); lstrcpyA(lpBuffer, lpFileName);
} }
else
{
CHAR szRoot[4] = "A:\\";
DWORD len;
szRoot[0] = lpFileName[0];
len = GetCurrentDirectoryA(nBufferLength, lpBuffer);
if (lpBuffer[len - 1] != '\\')
{
lpBuffer[len] = '\\';
lpBuffer[len + 1] = 0;
}
lstrcatA(lpBuffer, &lpFileName[2]);
}
}
else if (lpFileName[0] == '\\') else if (lpFileName[0] == '\\')
{ {
GetCurrentDirectoryA(nBufferLength, lpBuffer); GetCurrentDirectoryA(nBufferLength, lpBuffer);
@ -272,40 +289,6 @@ DWORD STDCALL GetFullPathNameA(LPCSTR lpFileName,
} }
} }
} }
#if 0
if (p[1] == '.' && (p[2] == '\\' || p[2] == 0))
{
lstrcpyA(p, p+2);
}
else if (p[1] == '.' && p[2] == '.' && (p[3] == '\\' || p[3] == 0) &&
prev != NULL)
{
lstrcpyA(prev, p+3);
p = prev;
if (prev == (lpBuffer+2))
{
prev = NULL;
}
else
{
prev--;
while ((*prev) != '\\')
{
prev--;
}
}
}
else
{
prev = p;
do
{
p++;
}
while ((*p) != 0 && (*p) != '\\');
}
#endif
} }
if (lpFilePart != NULL) if (lpFilePart != NULL)
@ -351,11 +334,28 @@ DWORD STDCALL GetFullPathNameW(LPCWSTR lpFileName,
if (!lpFileName || !lpBuffer) if (!lpFileName || !lpBuffer)
return 0; return 0;
if (isalpha(lpFileName[0]) && lpFileName[1] == ':') if (isalpha(lpFileName[0]) && lpFileName[1] == L':')
{
if (lpFileName[2] == L'\\')
{ {
lstrcpyW(lpBuffer, lpFileName); lstrcpyW(lpBuffer, lpFileName);
} }
else if (lpFileName[0] == '\\') else
{
WCHAR szRoot[4] = L"A:\\";
DWORD len;
szRoot[0] = lpFileName[0];
len = GetCurrentDirectoryW(nBufferLength, lpBuffer);
if (lpBuffer[len - 1] != L'\\')
{
lpBuffer[len] = L'\\';
lpBuffer[len + 1] = 0;
}
lstrcatW(lpBuffer, &lpFileName[2]);
}
}
else if (lpFileName[0] == L'\\')
{ {
GetCurrentDirectoryW(nBufferLength, lpBuffer); GetCurrentDirectoryW(nBufferLength, lpBuffer);
lstrcpyW(&lpBuffer[2], lpFileName); lstrcpyW(&lpBuffer[2], lpFileName);
@ -391,7 +391,7 @@ DWORD STDCALL GetFullPathNameW(LPCWSTR lpFileName,
{ {
p++; p++;
} }
while ((*p) != 0 && (*p) != '\\'); while ((*p) != 0 && (*p) != L'\\');
} }
else if (dwDotLen == 1) else if (dwDotLen == 1)
{ {
@ -406,7 +406,7 @@ DWORD STDCALL GetFullPathNameW(LPCWSTR lpFileName,
while (n > 0) while (n > 0)
{ {
prev--; prev--;
if ((*prev) == '\\') if ((*prev) == L'\\')
n--; n--;
if (prev == (lpBuffer+2)) if (prev == (lpBuffer+2))
break; break;
@ -422,48 +422,12 @@ DWORD STDCALL GetFullPathNameW(LPCWSTR lpFileName,
else else
{ {
prev--; prev--;
while ((*prev) != '\\') while ((*prev) != L'\\')
{ {
prev--; prev--;
} }
} }
} }
#if 0
DPRINT("prev %w p %w\n",prev,p);
if (p[1] == '.' && (p[2] == '\\' || p[2] == 0))
{
lstrcpyW(p, p+2);
}
else if (p[1] == '.' && p[2] == '.' && (p[3] == '\\' || p[3] == 0) &&
prev != NULL)
{
lstrcpyW(prev, p+3);
p = prev;
if (prev == (lpBuffer+2))
{
prev = NULL;
}
else
{
prev--;
while ((*prev) != '\\')
{
prev--;
}
}
}
else
{
prev = p;
do
{
p++;
}
while ((*p) != 0 && (*p) != '\\');
}
#endif
} }
if (lpFilePart != NULL) if (lpFilePart != NULL)