[PATCH 5/7] kernel32: Preserve a '/' delimiter in GetLongPathName and GetShortPathName.

Jeremy White jwhite at codeweavers.com
Mon Dec 21 10:51:56 CST 2015


Fixes the first issue on https://bugs.winehq.org/show_bug.cgi?id=36859

Signed-off-by: Jeremy White <jwhite at codeweavers.com>
---
 dlls/kernel32/path.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 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 */
-- 
2.1.4




More information about the wine-patches mailing list