GetShortPathName: always erase characters at the end of the new

string, and return only single backslashes.
This commit is contained in:
Uwe Bonnes 2000-04-06 19:31:11 +00:00 committed by Alexandre Julliard
parent fbace6eefe
commit 61f572a6ea
1 changed files with 7 additions and 2 deletions

View File

@ -939,8 +939,12 @@ DWORD WINAPI GetShortPathNameA( LPCSTR longpath, LPSTR shortpath,
/* check for path delimiters and reproduce them */
if ( longpath[lp] == '\\' || longpath[lp] == '/' ) {
tmpshortpath[sp] = longpath[lp];
sp++;
if (!sp || tmpshortpath[sp-1]!= '\\')
{
/* strip double "\\" */
tmpshortpath[sp] = '\\';
sp++;
}
lp++;
continue;
}
@ -967,6 +971,7 @@ DWORD WINAPI GetShortPathNameA( LPCSTR longpath, LPSTR shortpath,
SetLastError ( ERROR_FILE_NOT_FOUND );
return 0;
}
tmpshortpath[sp] = 0;
lstrcpynA ( shortpath, tmpshortpath, shortlen );
TRACE("returning %s\n", debugstr_a(shortpath) );