Module: wine Branch: master Commit: 9f3f918f2c0ff0c6117b3020623eeb430030ef23 URL: http://source.winehq.org/git/wine.git/?a=commit;h=9f3f918f2c0ff0c6117b302062...
Author: Jeremy White jwhite@codeweavers.com Date: Mon Dec 21 15:20:11 2015 -0600
kernel32: Preserve a '/' delimiter in GetLongPathName and GetShortPathName.
Signed-off-by: Jeremy White jwhite@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/kernel32/path.c | 12 ++++++------ dlls/kernel32/tests/path.c | 3 --- 2 files changed, 6 insertions(+), 9 deletions(-)
diff --git a/dlls/kernel32/path.c b/dlls/kernel32/path.c index ec14b35..ae211cc 100644 --- a/dlls/kernel32/path.c +++ b/dlls/kernel32/path.c @@ -334,10 +334,10 @@ DWORD WINAPI GetLongPathNameW( LPCWSTR shortpath, LPWSTR longpath, DWORD longlen /* check for path delimiters and reproduce them */ if (shortpath[sp] == '\' || shortpath[sp] == '/') { - if (!lp || tmplongpath[lp-1] != '\') + if (!lp || (tmplongpath[lp-1] != '\' && tmplongpath[lp-1] != '/')) { - /* strip double "\" */ - tmplongpath[lp++] = '\'; + /* strip double delimiters */ + tmplongpath[lp++] = shortpath[sp]; } tmplongpath[lp] = 0; /* terminate string */ sp++; @@ -492,10 +492,10 @@ DWORD WINAPI GetShortPathNameW( LPCWSTR longpath, LPWSTR shortpath, DWORD shortl /* check for path delimiters and reproduce them */ if (longpath[lp] == '\' || longpath[lp] == '/') { - if (!sp || tmpshortpath[sp-1] != '\') + if (!sp || (tmpshortpath[sp-1] != '\' && tmpshortpath[sp-1] != '/')) { - /* strip double "\" */ - tmpshortpath[sp] = '\'; + /* strip double delimiters */ + tmpshortpath[sp] = longpath[lp]; sp++; } tmpshortpath[sp] = 0; /* terminate string */ diff --git a/dlls/kernel32/tests/path.c b/dlls/kernel32/tests/path.c index 63666c6..37d14cc 100644 --- a/dlls/kernel32/tests/path.c +++ b/dlls/kernel32/tests/path.c @@ -863,18 +863,15 @@ static void test_PathNameA(CHAR *curdir, CHAR curDrive, CHAR otherDrive) if (pGetLongPathNameA) { sprintf(tmpstr,"%s/%s",LONGDIR,LONGFILE); ok(GetLongPathNameA(tmpstr,tmpstr1,MAX_PATH),"GetLongPathNameA failed\n"); - todo_wine ok(lstrcmpiA(tmpstr,tmpstr1)==0, "GetLongPathNameA returned '%s' instead of '%s'\n",tmpstr1,tmpstr); sprintf(tmpstr,"%s/%s",SHORTDIR,SHORTFILE); ok(GetLongPathNameA(tmpstr,tmpstr1,MAX_PATH),"GetLongPathNameA failed\n"); - todo_wine ok(lstrcmpiA(tmpstr,tmpstr1)==0, "GetLongPathNameA returned '%s' instead of '%s'\n",tmpstr1,tmpstr); } sprintf(tmpstr,"%s/%s",SHORTDIR,SHORTFILE); ok(GetShortPathNameA(tmpstr,tmpstr1,MAX_PATH),"GetShortPathNameA failed\n"); - todo_wine ok(lstrcmpiA(tmpstr,tmpstr1)==0, "GetShortPathNameA returned '%s' instead of '%s'\n",tmpstr1,tmpstr);