kernelbase: Don't strip leading dots in relative paths.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49315 Signed-off-by: Rémi Bernon <rbernon@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
0da35c26a1
commit
c27b2461a4
|
@ -1389,7 +1389,7 @@ BOOL WINAPI PathCanonicalizeW(WCHAR *buffer, const WCHAR *path)
|
|||
{
|
||||
src += 2; /* Skip .\ */
|
||||
}
|
||||
else if (src[1] == '.' && (dst == buffer || dst[-1] == '\\'))
|
||||
else if (src[1] == '.' && dst != buffer && dst[-1] == '\\')
|
||||
{
|
||||
/* \.. backs up a directory, over the root if it has no \ following X:.
|
||||
* .. is ignored if it would remove a UNC server name or initial \\
|
||||
|
|
|
@ -714,6 +714,15 @@ static void test_PathCombineA(void)
|
|||
ok(!lstrcmpA(str, "C:\\"), "Expected C:\\, got %s\n", str);
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
|
||||
/* try relative paths */
|
||||
/* try forward slashes */
|
||||
SetLastError(0xdeadbeef);
|
||||
lstrcpyA(dest, "control");
|
||||
str = PathCombineA(dest, "../../../one/two/", "*");
|
||||
ok(str == dest, "Expected str == dest, got %p\n", str);
|
||||
ok(!lstrcmpA(str, "../../../one/two/\\*"), "Expected ../../../one/two/\\*, got %s\n", str);
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
|
||||
memset(too_long, 'a', LONG_LEN);
|
||||
too_long[LONG_LEN - 1] = '\0';
|
||||
|
||||
|
@ -1039,6 +1048,22 @@ static void test_PathCanonicalizeA(void)
|
|||
!lstrcmpA(dest, "C:\\one/"), /* Vista */
|
||||
"Expected \"C:\\one/.\" or \"C:\\one/\", got \"%s\"\n", dest);
|
||||
|
||||
/* try relative forward slashes */
|
||||
lstrcpyA(dest, "test");
|
||||
SetLastError(0xdeadbeef);
|
||||
res = PathCanonicalizeA(dest, "../../one/two/");
|
||||
ok(res, "Expected success\n");
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
ok(!lstrcmpA(dest, "../../one/two/"), "Expected ../../one/two/, got %s\n", dest);
|
||||
|
||||
/* try relative forward slashes */
|
||||
lstrcpyA(dest, "test");
|
||||
SetLastError(0xdeadbeef);
|
||||
res = PathCanonicalizeA(dest, "../../one/two/\\*");
|
||||
ok(res, "Expected success\n");
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
ok(!lstrcmpA(dest, "../../one/two/\\*"), "Expected ../../one/two/\\*, got %s\n", dest);
|
||||
|
||||
/* try forward slashes with change dirs
|
||||
* NOTE: if there is a forward slash in between two backslashes,
|
||||
* everything in between the two backslashes is considered on dir
|
||||
|
|
Loading…
Reference in New Issue