mirror of https://github.com/snes9xgit/snes9x.git
win32: fix newly introduced bug of S9xBasename. I guess it could provide a wrong result when it processes a string which has both slash and backslash.
This commit is contained in:
parent
a91dfcb39b
commit
e4bf711227
|
@ -614,10 +614,25 @@ const char *S9xBasename (const char *f)
|
|||
const char *p = f;
|
||||
const char *last = p;
|
||||
const char *slash;
|
||||
const char *backslash;
|
||||
|
||||
// search rightmost separator
|
||||
while ((slash = strchr (p, '/')) != NULL || (slash = strchr (p, '\\')) != NULL)
|
||||
while (true)
|
||||
{
|
||||
slash = strchr (p, '/');
|
||||
backslash = strchr (p, '\\');
|
||||
if (backslash != NULL)
|
||||
{
|
||||
if (slash == NULL || slash > backslash)
|
||||
{
|
||||
slash = backslash;
|
||||
}
|
||||
}
|
||||
if (slash == NULL)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
p = slash + 1;
|
||||
|
||||
#ifdef UNICODE
|
||||
|
|
Loading…
Reference in New Issue